changes to use iterator