Some documentation, fixes

General fixes to things, including TreeNode. Documented some stuff, much
more needs doing.