refactoring context conversion