Optimization

Removed unnecessary operations in the for loop