Function getWaypoints