some refactoring and a few bugfixes relating to trip limits and coupon codes