moved index assignments to right spot