added foreach loop