Optimized code, v3