Sorting the route