replace replaces with the priority map