Added docstrings to functions