major housekeeping. flake-8 compat, sorted imports, utf-8 headers, other pep8 stuff