Added docstrings where necessary to functions and classes