Added search filtering code