More docs and code cleanup.