global context refactoring