index_mapping function finished, tested.