moved index into iterator