Flake8 fixes and cosmetic cleanup