rewrite with coffeescript