In 814, Charlemagne died. His only surviving son was Louis, king of Aquitaine, who became Emperor Louis the Pious. The kingdom of Aquitaine was transferred to Pippin, Louis' second son. Gothia was detached from Aquitaine and administered directly by the emperor, recreating the former duchy of Aquitaine. Louis had three sons, and in 817 he arranged an allocation of shares in their future inheritance. Pippin was confirmed king of Aquitaine, Louis the German was made king in Bavaria and eldest son Lothar became co-emperor (with future authority over his brothers).