docs and refactoring 2