Refactored server.coffee