Refactored code to move routes into new module.