Optimized the code.