Added docstrings to all functions