Improved the speed of filtering