Add flake8 checking and fix flake8 issues

Fixes #100.