Optimized order of filtering