Adding flake8 and fixing issues