getting rid of global variables