Added filtering logic