Doctors' leaders and the Government have agreed a new deal for junior doctors, with a new pay structure for working weekends and evenings.
The deal between the British Medical Association (BMA) and the Government will now be put to a ballot of medics after eight days of intense negotiations.
So what's the deal?
Under the deal, Saturdays and Sundays will attract premium pay if doctors - the vast majority of whom are expected to - work seven or more weekends in a year.
Doctors will receive a percentage of their annual salary for working these weekends - ranging from 3% for working one weekend in seven to up to 10% if they work one weekend in two.
-- David Galloway (@davidgallowaymd) May 18, 2016
Hooray, Junior Doctors have a deal. Relief all round and well done them for highlighting the issues
-- Vicki Barber (@vickster66) May 18, 2016
Any night shift - on any day - which starts at or after 8pm and lasts more than eight hours, and which finishes at or by 10am the following day, will also result in an enhanced pay rate of 37% for all the hours worked.
The deal also sets out systems of payment for doctors who are on call. This allowance is applied as 8% of basic pay over and above any weekend allowance that has been paid.
Across the board, there will be an average basic pay increase of between 10% and 11%, down from the 13% put forward originally by the Government.
There are also new agreements aimed at reducing discrimination to anyone who takes leave to care for others, such as new mothers or those on parental leave.
This includes accelerated training support to enable people to catch up, such as mentoring and study leave funding.
When will it come into effect?
Some elements of the new contract, if approved in the BMA's ballot of junior doctors, will be implemented in August and all junior doctors will move on to the new terms between October and August 2017.
What did Jeremy Hunt say?
The Health Secretary said: "We welcome this significant agreement which delivers important changes to the junior doctors' contract necessary to deliver a safer seven day NHS.
"The talks have been constructive and positive and highlighted many areas outside the contract where further work is necessary to value the vital role of junior doctors and improve the training and support they are given.
"This deal represents a definitive step forward for patients, for doctors and for the NHS as a whole."
okay so the junior doctors have found a deal... we still get to push Jeremy Hunt into a lake, right?
-- gfrancie (@gfrancie) May 18, 2016
He also told BBC News: "Well I think it's a very positive day for NHS patients and actually for doctors as well. From the Government's point of view we've got all the red lines that we needed to improve weekend care.
"The extra cost of employing another doctor at the weekends will fall by about a third under this agreement, which will make it much easier for hospitals to improve care at weekends."
He added: "But I think we also have to reflect that this has been a very bitter dispute. There are lessons to be learned on all sides.
"I think there was a message in the industrial action that unfortunately took place that there was a lot of unhappiness amongst junior doctors about things that weren't necessarily to do with their contract, to do with the way their training operates, to do with the quality of life in those very, very tough jobs.
"And we want to engage positively and constructively to address those issues because they are the backbone of the NHS."
And what about the BMA?
Dr Johann Malawana, the BMA's junior doctor committee chairman, said: "Following intense but constructive talks, we are pleased to have reached agreement.
"Junior doctors have always wanted to agree a safe and fair contract, one that recognises and values the contribution junior doctors make to the NHS, addresses the recruitment and retention crisis in parts of the NHS and provides the basis for delivering a world-class health service.
"I believe that what has been agreed today delivers on these principles, is a good deal for junior doctors and will ensure that they can continue to deliver high-quality care for patients.
"This represents the best and final way of resolving the dispute and this is what I will be saying to junior doctors in the weeks leading up to the referendum on the new contract."
Remind me, how did the dispute get here again?
Discussions surrounding the new contract first started in 2012 but broke down in 2014. These latest talks were seen as a last-ditch attempt to break the deadlock between junior doctors and the Government.
The agreement to resume talks follows a wave of industrial action launched by junior doctors in recent months, which saw thousands of operations cancelled.
Junior doctors stopped providing emergency care for the first time in NHS history during their most recent walkout. More than 125,000 appointments and operations were postponed, on top of almost 25,000 procedures cancelled during previous action.