Added flake8 to requirements. Minor code cleanup.

Codereview fixes for 52fb431