Added foreach

Fixed foreach