Update index function