Update/add docstrings and remove a couple of unused imports.
Add a bunch of tests