King Ottokar II of Bohemia improved fortifications and rebuilt the royal palace for the purposes of representation and housing. In the 14th century, under the reign of Charles IV the royal palace was rebuilt in Gothic style and the castle fortifications were strengthened. In place of rotunda and basilica of St. Vitus began building of a vast Gothic church, that were completed almost six centuries later. During the Hussite Wars and the following decades, the castle was not inhabited. In 1485, King Ladislaus II Jagello began to rebuild the castle. The massive Vladislav Hall  was added to the Royal Palace. New defence towers were also built on the north side of the castle. A large fire in 1541 destroyed large parts of the castle. Under the Habsburgs, some new buildings in Renaissance style were added. Ferdinand I built the Belvedere as a summer palace for his wife Anne. Rudolph II used Prague Castle as his main residence. He founded the northern wing of the palace, with the Spanish Hall, where his precious art collections were exhibited. The Second Defenestration of Prague in 1618 took place at the castle and began the Bohemian Revolt. During the subsequent wars, the Castle was damaged and dilapidated. Many works from  the collection of Rudolph II were looted by Swedes in 1648, in the Battle of Prague  which was the final act of the Thirty Years' War. The last major rebuilding of the castle was carried out by Empress Maria Theresa in the second half of the 18th century. Following his abdication in 1848, and the succession of his nephew, Franz Joseph, to the throne, the former emperor, Ferdinand I, made Prague Castle his home.. Which happened later, the Battle of Prague or The Second Defenestration of Prague