refactored trip controller