clean up fucking gross coffeescript, optimisations