redesigned the nextindex logic completely, I got to do the same thing for rma now