Updated to Ken's latest code.
Replaced for loop with iterator loop.