Optimizing sieves