Library refactoring, documentation cleanup.