Building a custom rule for filtering