Further refactoring of coffeescript