Clean up docstrings.
Add unit tests.