improved the filtering