Refactored server.js to use MVC