Use a struct to hold index