Add unit tests. Update docstrings.