Eliminate various global variables