Added some docstrings and tests