Replace 'for' loop with 'foreach'

Change-Id: I5ca01d678b8cf9e9fc75b21270329b483e31694e