Replaced 'for' loop with each (Ex5.1).