refactoring with a subcontext