Quality improvements and docstrings.