pep8 and doctest fixes