globals refactor