UK and EU negotiators have been working on a revised Brexit deal. Here are some of the issues that have been at the heart of talks over the last few days.
Only a few people know exactly what has been discussed behind closed doors, and the legal text of any proposed agreement has not been made public.
But it’s worth bearing in mind that most of the deal hammered out by Theresa May’s government – the withdrawal agreement and the accompanying political declaration – would remain in place.
The main changes Boris Johnson’s government wants to see concern the Irish border, and the type of relationship it wishes the UK to have with the EU in the future.
All sides have ruled out customs checks at the land border in Ireland (between Northern Ireland and the Republic), and Mr Johnson’s suggestion that checks could take place at “designated locations” away from the border was rejected by the EU.
That means there would have to be some customs checks within the UK instead, at ports along the Irish Sea between Great Britain and Northern Ireland. That’s a big UK concession.
But Mr Johnson also insists that Northern Ireland has to leave the EU customs union along with the rest of the UK, to allow it to take advantage of any future trade deals the government manages to negotiate.
The suggested compromise is that the legal customs border between the UK and the EU would be at the land border in Ireland. But the practical border, where checks would actually take place, would be in the Irish Sea.
It’s a dual customs system, which has no obvious parallel anywhere else in the world, and it raises plenty of technical and legal issues which will take some time to pin down.
There’s also the issue of political consent in Northern Ireland.
Both sides agree that any new economic status for Northern Ireland, which sets it apart from the rest of the country, needs to win democratic approval.
But the EU won’t accept anything that appears to give a veto to one party in Northern Ireland, in this case the government’s allies in the Democratic Unionist Party (DUP). That, in the EU’s view, would mean the entire proposed settlement on the Irish border could be unexpectedly torn up with nothing to replace it.
For its part, the DUP has been arguing that the Good Friday agreement, which forms the basis of the Northern Ireland peace process, provides for a dual majority (in other words a majority among both unionist and nationalist representatives) on controversial issues in the Northern Ireland assembly.
Its leader Arlene Foster tweeted: “Discussions continue. Needs to be a sensible deal which unionists and nationalists can support.”
Others in Northern Ireland argue that if a dual majority is needed, then the prospect of Northern Ireland leaving the EU should also be subject to similar dual consent.
It’s a complex issue, which has yet to be resolved, because the precise shape of a consent mechanism is important.
If there always had to be a dual majority to opt in to EU rules, that would be seen as a veto for unionists.
But if instead the dual majority was needed for opting out of EU rules, that would be seen as a veto for nationalists. Another option would be a referendum in Northern Ireland, which has not yet been ruled out by the government.
The UK has submitted a new draft of the political declaration on the future relationship. Again, the text has not been made public, but Boris Johnson has made it clear that he wants a looser economic relationship with the EU in the future than Theresa May was seeking.
The key phrase here is the “level playing field” – the degree to which the UK will agree to stick closely to EU regulations on things like social and environmental policies.
Mr Johnson wants to make fewer level playing field guarantees, and the EU fears that could mean he will seek to undercut EU regulation in the future to gain a competitive advantage.
And that in turn makes a number of EU countries even more determined that any solution for the Irish border is legally watertight and fully thought through, before they sign up to any amended Brexit deal.
On all of these issues, time is against the negotiators and their political masters. Boris Johnson still says he is determined to leave the EU on 31 October.
But if the House of Commons has not voted in favour either of a deal or of leaving with no deal by 19 October, then UK law says he must seek an extension to the Brexit process.
The EU says it will not negotiate directly with Mr Johnson during the summit on 17 and 18 October.
But the next few days are crucial.