Warning: spoilers for Avengers: Infinity War ahead.

“Fun isn’t something one considers when balancing the universe,” Thanos says in the first Avengers: Infinity War trailer. “But this does put a smile on my face.” He isn’t alone. When screenwriters Christopher Markus and Stephen McFeely were plotting out the film, they certainly put a lot of thought into how to use humor to balance the story, and to shore up some of the most difficult plot obstacles Infinity War would inevitably face. Humor has been a signature of the Marvel Cinematic Universe since the franchise launched with Iron Man in 2008. And humor is especially important throughout Infinity War — not just to distinguish Marvel movies from Warner Bros’ grim DC films, or Fox’s dour X-Men movies, or to shape heroes who are interesting because they can experience more than one emotion. It’s used strategically to address the film’s inherent problems, and ease viewers through them.

Film Frame / Marvel Studios

Problem: The number of key characters is dauntingly high.
Solution: Make the introductions hilarious.

Dedicated MCU fans who’ve seen all the leadup movies and remember them well enough to get the callback jokes will certainly get the most out of Infinity War. But Markus and McFeely didn’t want to entirely alienate viewers who mostly just check in for Avengers flicks, or skipped out on Thor 2 or the Guardians of the Galaxy films. Luckily, Infinity War is a crossover event where many of the heroes are meeting each…