Refactor filtering rule classes.