debugged the new filtering step