Updated with for loops