Numerous small fixes to prepare cycle.
Fix flake8 compliance.