Cleanup and more global variables moved to globals infrastructure.