iterator refactor; todo script