Add docstrings, fix pep8