moved global variables to be local