Localize some variables

There's no reason for them to be global.