set context refactoring