No need to be redundant with window
Use each instaed of for loop
Optimize each loop