Updated code for managing trips