Remove shadow declaration warnings for "index" variables

Use more specific variable names for each "index".