Resource context refactoring