Refactoring for preparing context filtering.