added comments
updated docstrings