added a for and foreach loops