Refactored routing, so it will allow for easier SDK generation