cleanup and docstrings