More coffeescript refactoring