<P> In 2770 T.A., while the young Thorin II Oakenshield was out hunting, the dragon Smaug flew south from the Grey Mountains, killed all the dwarves he could find, and destroyed the town of Dale . Smaug then took over the mountain, using the dwarves' hoard as a bed . King Thrór, his son Thráin II, and several companions escaped death by a secret door . Although Thrór and Thráin later perished, Thorin lived in exile in the Ered Luin until, by chance, he met the wizard Gandalf . Together they formed a plan to reclaim the mountain . Gandalf insisted that burglary was the best approach and recommended the hobbit Bilbo Baggins, whom he represented to be a professional thief . </P> <P> Thus Bilbo, Thorin, and Thorin's company of twelve other Dwarves travelled to the Lonely Mountain to regain the treasure . They planned to use the secret door, whose key Gandalf had managed to obtain from Thráin, whom he had found at the point of death in the pits of Dol Guldur . On Durin's Day, when the setting sun and the last moon of autumn were in the sky together, the day's last sunlight would fall on the door and expose its keyhole so that it could be unlocked . By a fortunate coincidence, this happened soon after Bilbo and the dwarves arrived, and the hobbit was able to enter the mountain and steal a golden cup . </P> <P> Smaug, enraged by the theft, emerged from the mountain and destroyed Lake - town, which he thought to be the source of the "thieves". During this attack Smaug was slain by Bard the Bowman, and Thorin claimed the mountain . However, the Men of Esgaroth, supported by Thranduil and the Elves of Mirkwood, demanded a part of the dragon's hoard as recompense for the destruction . Thorin, mad with greed, refused all claims and sent word to his second cousin Dáin II Ironfoot, chief of the Dwarves of the Iron Hills, who brought reinforcements to the aid of Thorin and Company . Before the battle began, however, an army of orcs and wargs descended on Erebor . Dwarves, elves, and men joined ranks against them, which led to the Battle of the Five Armies . During the battle, Thorin's nephews Fíli and Kíli were slain, and Thorin himself was mortally injured and died shortly afterwards . The title of King under the Mountain passed to Dáin . </P> <P> With the restoration of the Kingdom under the Mountain the area became prosperous again . Dale was rebuilt under Bard's leadership, and dwarves and men reforged their friendship . </P>

What happened to erebor after the battle of the five armies