updated index function