documentation and tiny refactorings