Optimized the hot inner loop.