Updated index function