More cleanup, translated to coffeescript