“Deadpool 2” takes care of some X-Men movie continuity loose ends during a post-credit scene.

This post contains spoilers for “Deadpool 2.”

After opening to $300 million worldwide in its debut weekend in theaters, “Deadpool 2” will almost surely not be the last mutant-filled Merc With a Mouth movie we see in our lifetimes. But just in case it is, Ryan Reynolds and company decided to tie up a few loose ends with a post-credit scene for the ages.

Taking advantage of a time-traveler (Cable/Josh Brolin) being a major part of the plot, “Deadpool 2’s” post-credit scene starts with Negasonic Teenage Warhead (Brianna Hildebrand) handing Deadpool Cable’s now-repaired time-travel device, which ran out of juice at movie’s end.

Deadpool, as you might expect, uses it to go back in time to fix the most shocking twist of the movie, the murder of his love-interest Vanessa (Morena Baccarin). But what followed were things no one saw coming but, after consideration, make total sense for a Deadpool movie.

First, we get a Hugh Jackman appearance. Sort of. If you’re enough of a Wolverine fan you can generally tell which “X-Men” movie you’re watching just by looking at Jackman’s hair. What we get in this post-credit moment is a slice of a scene from “X-Men Origins: Wolverine.” “Origins” is a low-point in X-Men movie history, a total waste of the classic “Origin” story from Marvel Comics. That comic tale revealed Wolverine’s secret beginnings as spoiled rich boy in a well-to-do part of Canada in the 1800s and was only a blip in the movie.

So, what’s Wolverine doing in a “Deadpool” movie?

One of the reasons fans thought “X-Men Origins: Wolverine” was a dud was the way the movie handled Deadpool. The character wasn’t disfigured (his trademark look under the mask) until the very end of the movie, he was wearing a red shirt instead of a red and black suit and mask, and when Wade Wilson first became Deadpool, well . . . he had no mouth. That’s right, the official debut of one of Marvel’s most talkative and sarcastic characters began with that character not being able to speak. Maybe it was a play on Reynolds’s Wade Wilson being so talkative on missions and getting on everyone’s nerves, but it felt very not Deadpool.

Reynolds must feel some sense of validation for now being able to portray Deadpool on the screen in two consecutive movies the way he wanted to, without studio interference from Twentieth Century Fox. So in this post-credit scene, instead of letting the Wolverine vs. Deadpool “X-Men Origins: Wolverine” scene play out, Reynolds’s updated Deadpool (the one who does have a mouth) pulls out a gun and takes out the “X-Men” Deadpool that many would agree should never have made it to the screen.

That scene felt like Reynolds apologizing to all of us for the “X-Men Origins: Wolverine” Deadpool that had swords growing out of his hands instead of hanging behind his back. That old Deadpool was horrible. We all know it. Reynolds knows it too. And Deadpool has become a successful enough franchise that it could give fans this “You were right” moment and move on.

But if you thought Deadpool was done taking out the trash, you were wrong. Because in the next scene we see Reynolds playing the real-life version of himself, sitting at a desk, gleefully reading the script to “Green Lantern,” perhaps the biggest superhero movie dud ever, while telling himself he’s hit the Hollywood big-time by landing the role of the classic DC Comics hero. Well, we all know how that turned out. Deadpool knew too, and delivers a bullet to Reynolds and tells all of Canada, “You’re welcome.”

Now if Deadpool can just make “X-Men 3: The Last Stand” go away in “Deadpool 3,” the X-Men movie universe will have been avenged.

Read more:

How a pioneering stuntwoman’s memory looms over ‘Deadpool 2’

The formation of X-Force was ‘Deadpool 2’s’ cruelest joke