Changed simulator to deal better with duplications