Moved some global variables to globals infrastructure.