added docstrings, comments