Use a proper for loop for an array