Fixing critical bug in flake8 tester.

Now it actually works.
Lots of PEP8 fixes.
Q model variables reverted.

Fixing some other small issues.
Adding flake8 check to default test suite.