added docstrings
added comments