By James Landale
The moment the death of the Queen was announced, officials organising her funeral began the mammoth task of arranging for hundreds of foreign dignitaries to travel to London.
They are responsible for making sure they turn up at the right place at the right time, and keeping them safe and secure, fed and watered.
One official likened it to arranging 100 state visits all in one go. The potential for error and diplomatic incident is huge. So it is no surprise that the Foreign, Development and Commonwealth Office is throwing the shop at the operation.
The department has set up a special headquarters called "The Hangar", where teams handling protocol, security, communications and diplomatic engagement are based.
More than 300 officials have been redeployed from their usual jobs to handle the administration, working 24 hours a day.
The first task was to get the right invitations sent out. The rule was that the head of every state with which the UK has diplomatic relations should be invited. But there are, of course, some exceptions.
No-one has been invited from Syria, Venezuela or Afghanistan, because diplomatic relations with them are so poor.
For the same reasons, no-one is coming from Myanmar. "We couldn't possibly ask anyone from Myanmar," one official said. "They've just put our former ambassador in prison."
No representatives from Russia or Belarus have been invited because of the war against Ukraine. And Iran, North Korea and Nicaragua have been asked to only send a senior diplomat.
Those with an invitation have also been told they can bring only one other person with them. That could be, say, either their partner or a head of government. So no entourage of hangers-on, no family members, no ministers.
That also means no former heads of government. American officials say that as of now, former US Presidents Barack Obama and Donald Trump are not expected to come. Although President Obama was close to the Queen, it's thought no exceptions will be made.
Exceptions have been made for the 14 Commonwealth countries where the King is now head of state. They can send their prime minister, governor-general (the king's representative in that country) and a high commissioner (the equivalent of an ambassador), each with one guest. They have also been allowed to invite 10 other guests – distinguished figures who in some way represent and reflect their communities.
There is still no definitive list of who is turning up. The deadline for RSVPs is Thursday.
Many of the invitations went out only very late last weekend. This was why there was a rather uncomfortable delay between President Biden saying on Thursday last week that he was willing to come, and the White House confirming it on Sunday – they couldn't say anything until the invitation had been received.
Other leaders are struggling to re-arrange their diaries – many were expecting to be in New York for the start of the United Nations General Assembly, which started on Tuesday. The prime minister of St Kitts and Nevis is having to send his foreign minister because the funeral falls on the same day as the country's independence commemorations.
Once the leaders arrive, there is the question of what they will do. Those here in good time on Sunday are invited to a reception with the King at Buckingham Palace.
There will be special arrangements put in place for those who want a chance to see the coffin lying in state.
Another hurdle is getting the leaders to Westminster Abbey on the day of the funeral – a logistical nightmare. The UK has diplomatic relations with about 185 countries. That means about 370 people, once their plus-ones are included. There will also be many representatives from European royal families. There simply would not be time for them to travel in separate vehicles. So most of them have been told they must meet at a secure area in west London to catch one of a fleet of luxury buses.
The possibility of kings and emperors and heads of state taking collective transport has raised some eyebrows, but officials in Whitehall are unapologetic.
"It is not about the vehicles, it is about making sure that the right people are in the right place at the right time," one said. "Do the maths, they simply couldn't come in separate cars."
Of course, there will be exceptions. US President Biden will be driven in his armoured vehicle known as the Beast. The President of Israel will also make his own arrangements.
The final task is figuring out where to seat them.
The seating plan will not be fixed until the guest list is finalised, but one official said they would most likely avoid any potential diplomatic incidents by using differing rank as an excuse to keep certain nations apart.
"An ambassador from a difficult country can always be found a space in a diplomatic enclave away from the VVIPs," one said.
How the Queen's funeral day will unfold
© 2022 BBC. The BBC is not responsible for the content of external sites. Read about our approach to external linking.
Funeral: Mammoth task of organising '100 state visits at once' – BBC
By James Landale