Got rid of global variable.