Improved comments and docstrings.