more docstrings and formatting