Modify longest route function in maps.js