refactor trip