Rewriting to make better use of coffeescript goodies