Get rid of global variables