Localized a few globals that didn't need to be