removed global index variable, LOL@ Cameron