changed angle calculation to atan2