Add filtering logic