Refactor iterations mechanism