refactor coffeescript