Cleanup and docstrings.