MDL:31989: Modified function for primary_filter