change data structure in populate from pair[array,array] to Map[pair]