change the for loop into for-each loop.