Complete the index function