fixed for loops for arrays, and started debugging window saving