The first certificate of foundation and the other documents were burnt in a great fire which destroyed the city around 1400. The privileges and rights were re-granted by King Władysław II Jagiełło in 1404. The city walls were built during the reign of King Casimir III the Great, and after the great fire, they were rebuilt at the beginning of the 15th century. During the reign of Casimir III, many expelled German Jews from the Holy Roman Empire migrated to the town, which grew to have one of the largest Jewish settlements in the kingdom.