Optimize total calculations.