code rearangement for readability and better naming of waypoints