refactored code, no more waypoints JS