95% of this is just flake8 refactoring, the part i changed is just below