renamed from iter_nd to nd_iter