Refactoring of filter.