WARNING: The following article contains spoilers for Avengers: Endgame, in theaters now.

After Thanos wiped out half of all life in the universe in the Marvel Cinematic Universe in last year's Avengers: Infinity War, Endgame was always going to be about the remaining heroes bringing everyone back. How Marvel's heroes would do that was much more of a mystery, and one of the real surprises in the film was when they managed to do it: five years after the cataclysmic snap.

In an interview with the New York TimesEndgame's screenwriters Christopher Markus and Stephen McFeely discussed their inspiration for using a time lapse in the plot.

RELATED: How Endgame Sets Up the Falcon & Winter Soldier TV Series

"That was what we bought ourselves by ending the last movie the way we did," said Markus. "We wanted it to be real and for a long time — both in movie time and in chronological time for the characters. You couldn’t end Natasha, Tony and Steve the way we do without knowing that they’ve done their time and this is taking them to the brink."

Asked if the five-year jump was inspired by any TV series, McFeely noted, "We talked about Fargo from the first season, where it just jumps a year. And you go, 'Whaaaaat?' We hopefully get a similar reaction."

RELATED: Chris Pratt Shares His 'Illegal' Avengers: Endgame BTS Video

"And when Lost had their flash forwards, you were like, how’d that happen," Markus added.

While time-jumps have occurred in plenty of TV shows including True Blood and Parks & Recreation, implementing a time jump holds some risks, especially for a movie series that's generally been set in the present day. While it's unclear what that means for the next few films in the series, the plot device seems to have worked out well this time, considering the enormous success of Avengers: Endgame and its overall solid reviews.

Directed by Joe and Anthony Russo, Avengers: Endgame stars Robert Downey Jr. as Iron Man, Chris Evans as Captain America, Mark Ruffalo as Bruce Banner, Chris Hemsworth as Thor, Scarlett Johansson as Black Widow, Jeremy Renner as Hawkeye, Brie Larson as Captain Marvel, Paul Rudd as Ant-Man, Don Cheadle as War Machine, Karen Gillan as Nebula, Danai Gurira as Okoye and Bradley Cooper as Rocket, with Gwyneth Paltrow Pepper Potts, Jon Favreau as Happy Hogan, Benedict Wong as Wong, Tessa Thompson as Valkyrie and Josh Brolin as Thanos.