Eliminate unnecessary index variable