refactoring context.h