Refactored wrap to allow multiple before and after routes