changing variables to global variables