added GetClosestWaypointFunction