Refactoring context service.