Coffeescript refactoring