refactoring with coffeescript