Code cleanup #3064: reorganize imports, other minor pep8 fixes
Merge pull request #3075 from mmarzantowicz/refactor

Code cleanup #3064: reorganize imports, other minor pep8 fixes