Refactor to support coffeescript and jasmine