add correct index function