Add docstrings where appropriate.

Many docstrings have embarrassing contents, but they highlight weaknesses in functionality and can be improved as the functions and classes are improved upon.