In 1306 Ziemomysł's son Casimir II swore allegiance to his uncle Władysław I, who began to re-unite the Lands of the Polish Crown under his rule. The duchy was devastated during the Polish–Teutonic War of 1326–32, culminating in the 1331 Battle of Płowce, but was finally restored by the Teutonic Knights in the 1343 Treaty of Kalisz. With the death of Casimir's son Władysław the White in 1388, the Kuyavian line of the Piast dynasty became extinct. After the union of Polish lands in the 14th century, the division into provinces and counties was introduced. That division finalized in the 15th century, existed until the dissolution of the Polish–Lithuanian Commonwealth in 1795. Kuyavia was divided into the two administrative divisions of Brześć Kujawski Voivodeship and Inowrocław Voivodeship. The voivodeship of Brześć-Kujawy was further divided into five powiats: Brześć, Kowal, Kruszwica, Przedecz and Radziejów, while the Inowrocław province was divided into the Bydgoszcz and Inowrocław powiats and Dobrzyń Land east of the Vistula.