Refactor server main.coffee.