Implemented isOnRoute function.