some refactoring for trip