Not long ago, the writing was on the wall for Kensington Palace. The deaths of Princess Diana and the Queen's sister, Princess Margaret, led to courtiers drawing up a plan to pension off the remaining royal residents and mothball the place before turning it into a permanent home for the vast Royal Collection of artworks and other treasures.
Retirement packages were prepared as thank-yous for the Gloucesters and the Kents (the Queen's ageing cousins) for their years of public service, with help to move out.
Yet nearly 15 years on, the Duke of Kent, 80, his brother Prince Michael, 74, and the Duke of Gloucester, 71, show no sign of retiring and remain full-time working members of the Royal Family.
They also continue to live in the rambling warren of 17th and 18th-century rooms that the Duke of Windsor disparagingly referred to as 'the Aunt Heap', a home for supposedly hard-up royal relatives.
And so Kensington Palace is flourishing. It is home to Prince William, the Duchess of Cambridge and Prince Harry - and from next year, we learnt this week, Princess Eugenie will be moving in.
She is to be given the use of Ivy Cottage, a three-bedroom property that until recently was the family home of the deputy head of the palace's property section, who has just retired.
The arrival of Eugenie, 26, who has been sharing a four-bedroom apartment in St James's Palace with her sister Princess Beatrice, 28, completes a transformation in the fortunes of 'KP', as Diana called it.
For years, it was said to be an unlucky royal home. Queen Victoria, who was born there, hated it, while for Diana, haunted by unhappiness, it came to be 'more prison than palace'. Princess Margaret's decline from being a vibrant party-goer - and party-giver - was marked by her loneliness, rattling around a 22-room apartment after her divorce from the Earl of Snowdon.
It is Margaret's four-storey residence, which also has an eight-car garage, that is now home to William, Kate and their children Prince George, three, and Princess Charlotte, one.
William's decision to return to his childhood home, the source of memories much happier than those of his late mother, triggered the regeneration. It followed a period of soul-searching and house-hunting.
Clarence House, where until his wedding he had shared an apartment with Harry, was briefly considered until his stepmother, the Duchess of Cornwall, loftily declared: 'There's no room here.'
Then there was St James's Palace next door - but William was said to find it 'rather gloomy'.
The only other option was Buckingham Palace, but imagine the upheaval - and the angst for Prince Charles - had the popular William set up home in his grandmother's official residence.
'It would have suggested a very dangerous message: that the Queen was apparently endorsing her grandson as her successor,' says a courtier.
Kensington Palace was where William really wanted to live with Kate. But he drew the line at returning to his mother's old flat, Apartments 8 and 9, because, according to Princess Michael, of the 'ghosts' of Diana. (Margaret's old flat is said to have a ghost, incidentally - a woman in a blue dress.)
After Diana's death, her apartment was stripped to the bare floorboards. Even the light fittings were removed.
For a decade it was left as a shell before being split into offices for charities, as well as providing a home for the head of the Army, General Sir Richard Dannatt, the Chief of the General Staff.
Thus William and Kate's first marital home - KP's Nottingham Cottage (where Harry now lives) - was of modest proportions. Self-contained, cosy and private, it was formerly the home of Prince Philip's private secretary, Brigadier Sir Miles Hunt-Davis, and his wife Gay.
Two years later and, after a £4.5 million taxpayer-funded refit, they were ensconced in Apartment 1a, Princess Margaret's old home.
Veteran palace staff have jokingly wondered whether repairs included the replacement of a loose-fitting drain cover outside the front door.
According to Margaret's former chauffeur David Griffin, Diana drove over the cover if she had a late-night assignation because the route was not covered by CCTV cameras. He said: 'Whenever the Princess heard the cover clanking late at night, she knew it was Diana and would peer out. It usually meant Diana didn't want anyone to see who she was bringing home.'
These days, 'the Aunt Heap' is not just home to Royals. The 50-plus residents include senior courtiers, military figures, domestic staff and even a few members of the public, who pay the market rent for accommodation.
In return, they get 24-hour armed police security, their own telephone exchange and a team of gardeners and craftsmen to maintain the palace, which was adapted for royal use by Sir Christopher Wren.
Among residents are the Queen's private secretary Sir Christopher Geidt, Lt Col Charles Richards, deputy master of the Household, the Queen's page Barry Mitford and his wife Amy, correspondence secretary Sonia Bonici, steward Mathew Palser and Stephen Murray, yeoman of the silver pantry (the royal silver).
Others include Prince Charles's long-time butler Tony Rabey and William and Kate's Italian housekeeper Antonella Fresolone, who used to be one of the Queen's housemaids. Clearly, with so many Royals and VIPs, the security - which we have purposely not highlighted in our graphic - is world-class.
Originally a Jacobean mansion, KP was bought in 1689 for the princely sum of 18,000 guineas by William III. Suffering from chronic asthma, he hoped to benefit from the Kensington air, which was cleaner than in the city centre, and commissioned Sir Christopher Wren to make it a home fit for a king.
Queen Victoria resisted moves to turn it into a national gallery. And despite similar attempts in this century - part of Prince Charles's plan to streamline the Royal Family - Victoria's descendants still live there today.
Thankfully for Princess Eugenie, her uncle Charles didn't pull off his plot to cut back.