added docstrings
tidying