turned relevant code into a usable js library, changed cakefile