Editing iteration function