made index global variable