VID-504 Eliminate some globals where unecessary