clean up iterators
update tests, refactor some functions in iterators