adding deletion check as well to filter