index modified for part2 of HW3