Making imports fit our current conventions and a couple flake8 compliance changes
Adding missing import and fixing bug in ORM access line