Some refactoring of filter processing