Updated filter logic