Who is Rick Sanchez? Is he simply an amoral (or post-moral) mad scientist with a drinking problem? Is he a reluctantly self-sacrificing grandfather who secretly loves the family he occasionally torments? Is he an anti-authoritarian hedonist with no regard for sentient life or anything else that stands in the way of his fun? Is he a man in pain who keeps himself constantly moving forward so as not to have to face his own demons and personal failings? Is he a jaded spacefarer who’s seen a universe’s worth of crap and has to dig through it to recover the remaining scraps of his humanity buried underneath?

Rick Sanchez is all of these things. He’s a man who’s keen to kick back and watch the turmoil of a “Purge Planet” like it’s a spectator sport. He’s a man who’s willing to sacrifice his own life to save his grandson. He’s a man who would create an entire miniature universe, complete with intelligent life just to power his spaceship. He’s a man who attempts to kill himself after being left by an old flame once more and told he’s a bad influence. He’s a man who has fought in a war, walked away from a failed marriage, and accordingly refuses to leave himself vulnerable. And he is also a man who scarred his daughter by abandoning her when she was young, but who later turned himself in to the authorities to keep her and her family from having to live as intergalactic fugitives.

In short, he’s complicated. It’s easy to mistake the divergent takes on the same character that inevitably emerge from the cacophony of voices in a T.V. writer’s room for complexity. But given Rick and Morty co-creator Dan Harmon’s history of writing damaged, multifaceted characters, it’s no stretch to see these characteristics as something more than just a jumbled series of inconsistent traits. Instead, they are signs of the conflicting impulses within one of the most three-dimensional characters to ever anchor a comedy as madcap and irreverent as Rick and Morty.

That’s what I liked most about “Wedding Squanchers”, the finale of the show’s second season — it leaned into that complexity, the baggage Rick carries with him and the parts of his personality that pull him in different directions, without oversimplifying them.

When Rick goes to Bird Person’s wedding, he’s absolutely morose about it. Someone he once fought beside, whom he considers his best friend, is opening up his life completely to another person, something that both picks at Rick’s insecurities about his own failed marriage and highlights his inability to do the same. It’s more than even the typically indifferent Rick can take.

And to add insult to injury, when, at his grandson’s urging, Rick seems to accept Bird Person and Tammy’s marriage as something potentially good, and he’s perhaps even willing to countenance the idea that meaningful personal relationships with others can be worth a few compromises, he immediately sees Tammy revealed to be a double agent, utterly betraying Bird Person and everyone he cares about, on behalf of a Galactic Federation that Rick utterly abhors.

The ensuing firefight and escape featuring Rick, Squanchy, and the Smiths is a great showcase for the inventive character design and stellar animation of the show. But the betrayal that precedes it, and Rick’s rant afterward, are just as striking. This, for Rick, is just a confirmation that he should remain detached and ambivalent, to his family, his friends, and even to Morty, his brainwave-camouflaging companion. It’s a justification for him to ignore whatever empathy he has left and give in to his shallow impulsiveness and his blasé, big picture mentality. To Rick, this is what the people you care about do to you; they hurt you, and in his eyes, that’s why you should never let anyone get too close, whether it’s Morty, or Unity, or even Rick’s own daughter.

The show’s shied away from bouncing Beth and Rick off of each other too often. In fact, it may be the character pairing that the show has explored the least. In some ways, it feels like Rick and Morty is saving that relationship, and all the story possibilities and character revelations that come with it, for a rainy day. But in-universe, it could be that Rick avoids spending too much time with Beth because she reminds him of Beth’s mom, or of the hurt he experienced in that relationship, or of lingering guilt from leaving Beth behind.

“Wedding Squanchers” certainly suggests that, for her part, Beth carries more than a little resentment of her father for his gallivanting about in space while she was left all alone, that she’s burdened with the sense that she wasn’t enough to keep her father from leaving.

Heck, while the show seems to have posited that Beth’s pregnancy was what prompted her and Jerry to get married, it’s not a stretch to speculate that part of why a capable woman like Beth was attracted to a putz like Jerry in the first place was that he was so “unremarkable”, in contrast to her father, that he would never possess the aptitude, let alone the ability, to have the kinds of goals and interests and predilections that she imagines prompted Rick leave her mother. Jerry, unlike Rick, is a man with a low ceiling, and it means he’s pretty damned unlikely to just blast off into space one day.

But the world-building of this episode suggests that maybe there’s more to the story. There’s a Galactic Federation that Rick once cared enough about that he took up arms against it alongside Bird Person and Squanchy and others. Maybe Beth’s mother didn’t understand that. Maybe Rick was captured by the Galactic Federation and was too proud or embarrassed to explain to his family why he was gone for so long.

Or maybe, Rick felt like he had to leave Beth and her mom to protect them, because he was a wanted intergalactic criminal, and he knew they would never be safe with him around. And maybe the saddest part of the ending of “Wedding Squanchers” is that Rick finds himself having to do the same thing all over again, that he’s facing the cold reality that letting yourself care about people forces you to make sacrifices for them, and that those sacrifices can be as hurtful to the people you love as they are necessary, or as devastating as Beth’s realization that her father is once again gone, possibly never to return, will invariably be.

Despite all of this heavy thematic and emotional material that the season finale traffics in, Roiland, Harmon & Co. don’t skimp on the comedy. The wedding lent itself to all kinds of great gags, like Jerry’s awkward attempts to network, Beth’s trouble with the proper usage of the word “squanch”, and a bevvy of one-off bits like a Lettuce Alien being mortified to see a salad. What’s more, as a fervent if somewhat conflicted Battlestar Galactica fan, it’s nice to see Tricia Helfer and James Callis cameo as a pair of secret killer robots. And the trio of possible new planets for the Smiths to call home were great fodder for comedy as well, from the yelping sun of one world, to the inexplicably deal-breaking cob-based molecular structure of another, to the tiny planet the Smiths eventually settle on, which lent itself to all sorts of fun visual gags.

But that comedy makes the gut punch of Rick turning himself in to the Galactic Federation at the end of the episode all the more potent. As Rick and Morty’s spiritual predecessor in animated science fiction comedy demonstrated, when the comedy folks delve into tragedy, the juxtaposition can make those heavier moments more affecting, and more effective, than when their drama counterparts attempt to do the same.

The final montage of Rick offering himself up to the authorities, with the Smiths going home to an Earth that’s been colonized by the same Galactic Federation, is a poignant one. In truth, using “Hurt” feels a little trite after both the Nine Inch Nails version (heard in this episode) and/or the Johnny Cash version, have appeared in everything from Criminal Minds to The Hangover to WWE tribute videos. But the impact of seeing Rick leave behind his “empire of dirt”–which, as he points out, is what Planet Earth is named for–in order to save his family from a life on the run, thereby cutting himself off from the few people with whom he’s managed to forge something approaching a real connection, is still keenly felt, in no small part because it once again separates him from his daughter.

Rick Sanchez is a complex individual, the kind who can believably fight an intergalactic empire, tell off his grandchildren, hardly blink when his son-in-law is whisked away to another planet in a floating meatball, and be an egotistical asshole, a brilliant scientist, a self-loathing prick, an avuncular-if-deranged mentor, a selfish bastard, and a noble, wounded, self-sacrificing father, all at the same time. There are many things that make Rick and Morty a good show, but the intricate depth of its title character are part of what makes the series, and episodes like “Wedding Squanchers”, into something great.