use foreach instead of iterator in another place