REFACTOR: Refactored code to support routes/be more modular.