Coffeescript rewrite