modified the waypoint generator code