CFY-516 flake8 and some other fixesg