added a for loop to go through the array