improve index hw3 part2