Got rid of the global variables