Rewrite JavaScript in CoffeeScript