localize some imports

I remember @9rnsr  once asking for imports to go at the top of a local scope, as failure to do so could introduce subtle name resolution bugs. I can't remember how though.