Remove all globals variables

Remove all instances of global variables
from the code because globals are bad.