refactor into roots, stage 1
convert js to coffee