Port main.js to CoffeeScript