Rewritten with coffeescript