Optimized code

Optimized code