Some cleanup and docstrings