modify API to return index when asked