Added docstrings, and improved some of the comments on several tasks.