Refactored routing into model