The best comedy on television, Rick and Morty, helped make Ant-Man and the Wasp one of the funniest and kookiest Marvel films to date.

In an interview published last week with Birth.Movies.Death., director Peyton Reed talked about his goal of making Ant-Man and the Wasp “as densely funny as we could.” In addition to letting star Paul Rudd use his natural comedy skills more than in the first movie, Reed and the rest of the creative team also looked to Rick and Morty as a source of inspiration for scripting their own sci-fi comedy.

Reed claimed that behind the scenes, they’d think, “How Rick and Morty can we get with some of the concepts?” As it turns out, getting very Rick and Morty only made Ant-Man and the Wasp better.

Spoilers follow for a crucial scene in the middle of Ant-Man and the Wasp.

Reed references a scene from the movie during which Michelle Pfeiffer’s Janet Van Dyne channels her consciousness from inside the Quantum Realm through Paul Rudd’s Scott Lang. Viewers then watch Lang, aka Ant-Man, interact with Hope Van Dyne and Hank Pym as if he’s their long-lost mother and wife, respectively. It’s some seriously entertaining sci-fi body swapping.

“The idea came up that Janet has left a psychic bread crumb in Scott’s head,” Reed explained. “The insurance policy was Rudd, because we knew he could do it.” And he did.

Paul Rudd as Scott Lang, aka Ant-Man, in 'Ant-Man and the Wasp'.
Paul Rudd as Scott Lang, aka Ant-Man, in 'Ant-Man and the Wasp'.

“I think one of the things that makes Rick and Morty so popular is that you can take weird hard science concepts and make them funny and understandable, and always pivot left to defy expectations,” Reed said, explaining how this style of storytelling allowed them to tell a new kind of Marvel story that we haven’t really seen before. “We’re the 20th Marvel movie! We have to do that, we want to, and audiences want it.”

So the comedic equation essentially became Rick and Morty + Paul Rudd = Ant-Man and the Wasp and it paid off.

And if Rick and Morty was on Peyton Reed’s mind while directing Ant-Man and the Wasp, then is it possible that alternate realities in an infinite multiverse could impact the future of the Marvel Cinematic Universe? In the first post-credits scene for Ant-Man and the Wasp, Scott wound up trapped in the Quantum Realm where there are “Time Vortexes” but potentially wormholes into other dimensions.

So in some fashion, it looks like the future of the MCU is more Rick and Morty than we could possibly imagine.

Ant-Man and the Wasp is now in theaters.