still have to duplicate trip_index variable from local scope to root scope