partial rewrite using mocha and coffeescript