PEP8 and other minor fixes