get rid of global variables