Got rid of all the global variables