The Rick and Morty writers’ room is often as chaotic as the show itself, and one of its writers recently divulged that one of the show’s craziest, and best, episodes was inspired by none other than Buffy the Vampire Slayer.

In a recent interview on the Y Combinator podcast, Ryan Ridley — one of the writers on Rick and Morty — offered up insight to the inner workings of the show’s writers’ room, even explaining how one of Rick and Morty’s best episodes came to fruition.

In “Total Rickall,” the Smith family household is beset by a self-replicating alien parasite that plants false memories in everyone’s minds and creates all sorts of zany characters. Before long, the entire house is on lockdown with dozens of characters like a talking fridge, a butler, Photography Raptor (exactly what it sounds like), a talking pencil, a magical flying pony, and even Frankenstein (the Monster).

Ridley confirmed that many of Rick and Morty’s episode titles are mostly nonsense, casually riffing on other barely related and well-known properties. The only thing Total Rickall and Total Recall have in common is the planting of false memories, but it’s a chief example of how the writers on Rick and Morty combine tropes and ideas from other stories to make something fresh. And Total Rickall is based more on Buffy the Vampire Slayer than it is Total Recall.

“I think [Mike] McMahan pitched that as, ‘Oh, in Buffy the Vampire Slayer, Season 5, they introduce this character, Dawn, as her sister,’” Ridley said. “Everyone’s pretending — I mean, they’re not pretending — they’re treating her like she’s always been there. But you know that, as a viewer, [Buffy] hasn’t had a sister for the first four seasons. So you find out the supernatural explanation for why that is.”

In a meta-contextual way, it’s not just the audience that questions the reality of these new characters that appear during “Total Rickall”; Rick is quick to guess that “Uncle Steve” is a parasite, and shoots hit right in the head with a laser.

“That’s where it started,” Ridley said, “and then we built on top of that The Thing element: They’re all trapped in the house, and they’re all suspicious, and then … I think [Dan] Guterman pitched the idea of, ‘Well, what if this is a way to do a clip show?’” Ridley refers to common episodes in shows where most of the screentime is spent cutting back to quick flashback scenes.

“So you’re actually throwing the clips, but the clips themselves are not memories in the sense of like, a traditional clip show, they’re actually part of the sci-fi.” Each “clip” that gets thrown back to is the mechanism through which the parasite replicates; they create a new pleasant memory to introduce a new character the “real” characters fondly remember.

The many different tropes and storytelling techniques converge in one of the most entertaining Rick and Morty episodes to date. “So it ends up being a patchwork of different references that are hopefully combined enough so we’re not doing a spoof of any one thing,” Ridley said.

So it looks like we have Buffy the Vampire Slayer, The Thing, and Total Recall to thank for the creation of one the show’s most beloved — and very real — characters: Mr. Poopybutthole.