add docstrings, PEP8 fixes