added comments
added docstrings