added carousel index function.