When the Elector of Bavaria Maximilian III Joseph, the last ruler from the Bavarian branch of the Wittelsbach dynasty, died childless in 1777, his throne passed to Charles Theodore, count and elector of the Palatinate. The new ruler preferred his existing home in Mannheim on the Rhine to living in Bavaria and tried unsuccessfully to trade his unloved inheritance for the Austrian Netherlands. Understandably, the people of Munich returned his disdain. To offset this unhappy atmosphere, Charles Theodore devoted much attention to improvements in the city. Among others, he created an art gallery in the northern arcades of the Residence's "Hofgarten" ("Court Garden") and made both the garden and the new gallery open to the public (the former in 1780, the latter in 1781).