continued refactoring to globals