Breaking Bad creator and showrunner Vince Gilligan has spoken about the difficulties he encountered while deciding how the show ends.
In an interview with Radio Times he said: "We decided very late in the game. We had about eight or ten months to work on these final eight episodes.
"I have six excellent writers, and the seven of us together worked many hundreds of thousands of man-hours to figure out this ending.
"We didn't really figure out the very ending until about a month or a couple of weeks before we wrote it.
"There was a great deal of tension in the constant anxiety that we wouldn't end this correctly. And then we figured out the ending."
The showrunner described the final run of eight episodes - the second half of the show’s fifth season - as "one wild ride", and also spoke about the inspiration behind the central character, Walter White.
"I was about to turn 40 years old and was starting to feel a mid-life crisis coming on,” he recalled. “That was the point where this idea came to me and I think the character is not based on any real person out there.
"If anything, I was probably thinking of myself. I've never been a teacher but I've got several former teachers who have been very important in my life.
"My mum is a retired schoolteacher and my girlfriend is a retired schoolteacher. That was probably an inspiration. I was thinking in terms of all of those things, but mostly in terms of a guy who's having a really bad mid-life crisis."
The final eight episodes of Breaking Bad air on August 11 on AMC in the USA, and on Netflix in Ireland from August 12.