Misc documentation and code cleanup