get_index function added to data.c