Refactoring to separate modules out of server.js