Adding docstrings and doctests