Fixes, code cleanup, documentation.