Documentation +minor refactoring