ex5. need to remove the foreach loop