Improve the atan2 function