Moved code to coffeescript files