Rewriting some more coffeescript as javascript