atan2 and ceil modification