PEP8, code cleanup, add docstring