A technique for the analysis of the scattering from gently undulated finite surfaces