Get rid of some global variables