An improved two-dimensional phase unwrapping procedure is discussed that uses a weighted least-squares algorithm, a congruence operation, and a filter to unwrap the phase distribution of an electromagnetic beam. These improvements make possible several advances for mirror designs used in gyrotron quasi-optical mode converters. The improved phase unwrapping procedure is demonstrated by applying it to a measured beam and a simulated beam that are used to design mirrors. The unwrapping procedure produces a smooth unwrapped phase that does not change the characteristics of the beam. The smooth unwrapped phase distribution is also used to find an estimate for the wavenumber vector distribution that is needed to design the mirrors.