Improved phase retrieval algorithms for wavefront sensing