added atan2 function