coffeescript refactor