rewrite main.js in coffeescript