Write map_with_index