Atan2 refine

This PR includes a first version of the function refine_atan2 function making it more readable an correcting some errors in the doc string.