General import and flake8 cleanup.