code cleanup and documentation fixes.