Got rid of unnecessary global variable