First pass on documentation and some minor cleanup.