small refactor to iterator