remove impurities through filtering