Minor code cleanup, and significantly expanded documentation.