some TODOs done, pretty-printing some of the code