the square-plan tower erected in (1534) with the aim to protect the port, several settlements started appearing. The 17th century was perhaps one of the most difficult periods for the 300 inhabitants of Viareggio; the area was insalubrious, malaria and other deadly epidemic diseases made the lives of fishermen and farmers extremely difficult. Lucca, on the other hand, increased its efforts to drain the marshlands to improve quality of life and encouraged migration to the new town. Slowly Viareggio changed its appearance; two small churches and as many factories were built, followed by a number of small shops. Meanwhile its port became more active, while the cultivation of the drained fields started. 18th and 19th centuries In 1701 Viareggio became a comune (municipality). In 1739, thanks to the work of hydraulics engineer Bernardino Zendrini, the marshlands were finally completely drained and the town turned into a place where noblemen from Lucca came and built their palaces. In May 1799 Viareggio was the centre of a popular uprising against the Jacobin Club. With the invasion of Italy by Napoleon the Lucchese state was turned into a principality whose sovereignty was given to Felice Baciocchi, although the real power was in the hands of Napoleon's older sister, Elisa. Elisa's government was characterised by unpopular measures such as those against the ecclesiastic patrimony. Similarly, most of her financial policies were of dubious effect, although some were welcomed by the locals, such as the adoption of the "Napoleonic Code," the adoption of the metric system, and the introduction of mandatory vaccination against smallpox. With the fall of Napoleon and Baciocchi, Viareggio was the centre of several acts of violence. In March 1814 the population openly protested against the French, an event which turned into acts of pure vandalism. Viareggio remained under the control of the Austrians until 1817 when, as part of the agreements from Congress of Vienna, Maria Luisa of Spain was assigned the new Duchy of Lucca. The years to come would wipe out any good action that had been taken during the Napoleonic rule, although the new ruler would contribute to the town's expansion by building its first marina (seaside). In 1820 Viareggio obtained the status of city. Following the death of his mother (March 13, 1824), Charles Louis of Parma took over the government of Lucca and greatly contributed to Viareggio's expansion, by building a new church, a royal casino