refactoring, docstrings