Minor refactoring, documentation improvements.