Optimize your waypoints for your route. Using the 'computeBestOrder' in the routing API to optimize by distance.