More docstrings and some unit tests