It was an important fortified settlement at the end of the 9th century. The first written reference to Bratislava from 907 is related to this period; it mentions a battle between the Bavarians and early Magyars under the Brezalauspurc Castle. The last stage of big building alterations of the Bratislava Castle was accomplished by Maria Theresa. She had all fortifying elements of the Pallfys castle removed and simultaneously improved or extended its residential functions complying with the criteria of what was then considered the utmost luxury. The most interesting building though was that of what was later on called Theresianum which was added to the eastern front side of the palace in 1768.