Small refactorings and documentation improvements