Hoist all the vars to make scope clear

Compiler does this anyway, make it explicit.
Address comments