By the Reality Check team at BBC News
A new Brexit deal has been agreed by the UK and EU. Here's what's in it.
After weeks of talks, negotiators from Britain and the European Union reached a revised Brexit deal, addressing key issues relating to the border between Ireland and Northern Ireland.
It is due to go to a vote in Parliament at the weekend, but British Prime Minister Boris Johnson's allies, the Northern Ireland's Democratic Unionist Party (DUP), have said they cannot support it. Despite that, Mr Johnson said today he was "very confident" MPs would back the agreement. The European Union's 27 other leaders have endorsed it.
All sides want to avoid the return of a "hard border" between Northern Ireland and the Republic of Ireland after Brexit - with checks and infrastructure which could be targeted by paramilitary groups.
Coming up with solutions to this - acceptable to all sides - has been very challenging.
The new protocol replaces the controversial Irish backstop plan in former Prime Minster Theresa May's deal. Much of the rest of that deal will remain.
Here are some of the key new parts:
The whole of the UK will leave the EU customs union. This means the UK will be able to strike trade deals with other countries in the future.
There will be a legal customs border between Northern Ireland and the Republic of Ireland (which stays in the EU). But in practice the customs border will be between Great Britain and the island of Ireland, with goods being checked at "points of entry" in Northern Ireland.
Duty (tax) won't automatically have to be paid on goods coming into Northern Ireland from Great Britain.
But where something is "at risk" of then being transported into the Republic of Ireland (which is part of the EU customs union), duty will be paid.
A joint committee made up of UK and EU representatives will decide at a later date what goods are considered "at risk".
It might be that duty is paid on goods that do not end up being sent on from Northern Ireland into the EU. The UK would be responsible for whether to refund the duty in these circumstances.
Ordinary people won't have their baggage checked and duty won't apply to individuals sending goods to other people.
There will also be limits agreed by the joint committee on the amount of help the government can give to Northern Irish farmers. The figure will be based on the amount they currently receive from the EU's Common Agricultural Policy.
Regulations on goods
When it comes to the regulation of goods, Northern Ireland would keep to the rules of the EU's single market, rather than UK rules.
That removes the need for product standard and safety checks on goods at the border between Ireland and Northern Ireland, because both will be part of an "all-island regulatory zone".
But it adds to the checks between the rest of the UK - which will not be sticking to EU single market rules - and Northern Ireland.
Enforcing the rules
This will be done by UK officials at "points of entry into" Northern Ireland, but the EU will have the right to have its own officials present.
It seems those EU officials may be able to overrule UK officials. "Where the Union representative requests the authorities of the United Kingdom to carry out control measures in individual cases for duly stated reasons, the authorities of the United Kingdom shall carry out those control measures."
Northern Ireland's say
Because Northern Ireland will be set apart from the rest of the UK when it comes to customs and other EU rules, the deal gives its Assembly a vote on these provisions.
But this vote would not happen until four years after the end of the transition period that is due to run until the end of 2020 - so no earlier than January 2025.
If the Northern Irish Assembly votes against the provisions, they would lose force two years later during which time the "joint committee" would make recommendations to the UK and EU on "necessary measures".
If the Assembly accepts the continuing provisions by a simple majority, they will then apply for another four years. If the deal has "cross-community support" then they will apply for eight years, or until a new agreement on the future relationship is reached if that comes sooner.
The deal defines cross-community support as more than 50 percent each of unionist and nationalist Assembly members voting in favour, or at least 40 percent of members from each designation if in total at least 60 percent of members have voted in favour.
The UK government has said that if the Northern Ireland Assembly is still not sitting at that point, it will make alternative arrangements to make sure a vote can take place.
The new agreement says that EU law on value added tax (VAT - a tax added when you make purchases) will apply in Northern Ireland, but only on goods, not services.
But it also allows Northern Ireland to have different VAT rates to the rest of the UK, which would not normally be allowed under EU law.
For example, if the UK decided to reduce the VAT on household fuel to zero, Northern Ireland would still have to keep it at 5 percent which is the EU minimum.
It also means that Northern Ireland may get the same VAT rates on certain goods as the Republic of Ireland, to stop there being an unfair advantage on either side of the border.
Some things have not changed:
Much of in former Prime Minster Theresa May's original Brexit deal will remain as part of the overall agreement. Some of the key areas are:
The transition - a period of time during which all of the current rules stay the same allowing the UK and the EU to negotiate their future relationship - is due to last until the end of December 2020.
The UK will need to abide by EU rules and pay into the EU budget, but will lose membership of its institutions.
The transition can be extended, but only for a period of one or two years.
Both the UK and EU must agree to any extension.
UK citizens in the EU, and EU citizens in the UK, will retain their residency and social security rights after Brexit.
Freedom of movement rules will continue to apply during transition. This means that UK nationals will be able to live and work in EU countries (and EU nationals will be able to live and work in UK) during this period.
Anyone who remains in the same EU country for five years will be allowed to apply for permanent residence.
The UK will have to settle its financial obligations to the EU.
There is no precise figure but the biggest part of this "divorce bill" will be the UK contributions to the 2019 and 2020 EU budgets.
As Brexit was delayed from 29 March to 31 October 2019, some of that money has been paid as part of the UK's normal membership contributions already. The Office for Budget Responsibility (OBR) estimates that the bill is now around £33bn (down from £39bn).
The OBR expects that most of the money - around three-quarters of the total - would be paid by 2022, with some relatively small payments still being made in the 2060s.
Future UK/EU relationship
This is addressed in the political declaration. This text, which is not legally binding, has also been revised by UK/EU negotiators.
It says that both sides will work towards a Free Trade Agreement (FTA) and a high-level meeting will be convened in June 2020 to take stock of progress towards this goal.
The text also contains a new paragraph on the so-called "level playing field" - the degree to which the UK will agree to stick closely to EU regulations in the future.
While the references to a "level playing field" were removed from the legally binding withdrawal agreement, the revised political declaration says that the UK and the EU should "uphold the common high standards in the areas of state aid, competition, social and employment standards, environment, climate change, and relevant tax matters".