Adding docstrings and commenting the code