renamed index2 to index