Replaced all references to the variable index with references to the array. Did the same with timeCollect. Changed reset function to not clear index and timeCollect positions in the array.