refactor, docstrings