refactored app_waypoint.js and waypoint.js