docs and refactoring