Context refactoring