cleanups, more docs, remove dead code