Added helper function & base shortestTrip