Boring linty stuff

Fixing some undefined variables and global namespace pollution, along
with other even less exciting things.