Added the index function