revise index to use array