At 12 seasons and counting, the show is a vivid timeline of evolving American sentiment.

It’s Always Sunny in Philadelphia is a beautiful show about horrible people. As much as we love the gang, it’s hard to actually like them. And while for the first few seasons they could best be described as jerks or misfits, over the years they’ve morphed into full-on sociopaths who lie, cheat, steal, and very possibly kill without a second thought.

But as the characters have gotten undeniably worse, the creative minds behind them have grown much more conscientious.

This is the key, probably, to the show’s longevity. Because Always Sunny has been on for twelve seasons. And it’s already been renewed for two more, setting it on course to tie (and then, if there is a God, beat) the record for longest-running live-action comedy series ever.

And when you’ve been on the air since 2005, you have to make some changes. The political climate today is not what it was 13 years ago, and the jokes audiences are prepared to laugh at are not the same. That being said, Always Sunny has forever danced along the line of what audiences are willing to accept, especially on cable tv. With little in the way of censorship and a lot of leeway in the name of satire, the show exists right at, or sometimes just over, the line of what it’s okay to laugh at.

This, combined with its sheer age, makes it a veritable timeline of the evolving political landscape of the last decade and a half.

This is best examined in terms of the exemplary season 12 episode “Hero Or Hate Crime?” which aired in 2017. In it, Mac is nearly crushed to death by a falling piano, and he’s only saved when Frank gets his attention by yelling “look out faggot.” Frank saves his life, but his methods are seriously called into question.

The title is a callback to a season 1 joke, in which Mac accidentally punches a trans woman in the face. When two onlookers threaten to beat him up for hitting a woman, he explains that “It’s a dude. She has a penis, so it’s okay.” The onlookers ask each other if this is a hate crime, decide that it is, and then chase Mac to beat him in earnest.

Twelve years later, the joke is back, but it’s been reworked into a serious (though still deeply funny) meditation on the power of language. And fittingly, Mac, the original perpetrator, is the victim now.

Because after twelve years, Mac’s finally officially gay. Was Mac always meant to be gay? Most shows don’t start with a 12+ year long arc in mind, so maybe not. But even if inadvertently, his story has become a very reliable way to chart America’s perception of and conversation surrounding homosexuality.

Mac’s sexuality was a fuzzy area from the beginning. Carmen, the trans woman he hits in the face, is older than the show itself, appearing in the unaired pilot as Mac’s love interest. Her plot is expanded in the season 1 episode “Charlie Has Cancer,” where she exists mostly as a visual punchline, a beautiful woman with a bulge in her tight jeans. It is not an episode that would fly now.

But even in these early days, the attitude of the creators is obviously at odds with that of the characters. (The episode is in fact written by Rob McElhenney, who plays Mac). Because even in that first episode, Carmen is practical and extremely comfortable with herself. She might be the most well-adjusted person in a whole season of misfits.

So while the gang treats her horribly — Mac is ashamed and his friends are disgusted — Carmen actually holds her own. And when she returns in the third season for “Mac is a Serial Killer,” she seems to have earned even more of the show’s respect. In a happy but secret relationship with Mac, she finally puts her foot down and kicks him out when he admits that he’s ashamed of himself for sleeping with her. Mac, meanwhile, is so ashamed that his friends mistake his sneaky actions for those of a murderer. They’re still disgusted when the truth comes out, but the stance behind the writing seems crystal clear — the gang are the ones at fault here.

The fact remains, however, that the episode culminates in four people berating their friend for sleeping with a pre-op trans woman, and it’s played for laughs. Three years later, in the season 6 premiere “Mac Fights Gay Marriage,” the show is no longer joking around. Carmen has had her surgery and is happily married to a man, launching Mac on a blind crusade against both homosexuality and introspection. If there were any doubt, it’s very obvious by this point that Carmen is the normal one, and that Mac has some serious religion-induced repression.

Most notable in season 6 is the rest of the gang’s obvious attitude shift. They use Carmen’s correct pronouns, and they congratulate her on her wedding. They’re all in favor of marriage equality (still five years before the Supreme Court ruling). The only one who takes some catching up is Frank, ever the convenient voice of outmoded thinking. But even he eventually comes around, so much so that he enters a domestic partnership with Charlie. His rationale is about as good as he’s going to get: “Two dudes gettin’ married — that doesn’t seem very gay.”

In other words, by 2010 transphobia and homophobia are no longer funny, even coming from people as horrible as the gang.

Instead, all of their negative attitudes are funneled into Mac, who himself becomes more and more overtly gay. From a general interest in “beefcakes” all the way to coming back from a gay bar covered in glitter and “not answering any questions,” Mac spends the better part of a decade in a closet with no door. He even comes out during a brief crisis of faith in season 11, only to take it all back when he decides God is real after all. Because that’s something the show has been firm about for years — Mac won’t come out because he thinks of himself as a tough Catholic, and tough Catholics aren’t gay. While Mac may be the butt of many a gay joke, he’s always the one making them, and the real joke is on the society that’s made him deny himself — one of toxic masculinity and religious rigidity.

Meanwhile, the gang’s treatment of Mac’s sexuality turns from disgust into bemusement, then exasperation, then finally furious support, when in “Hero Or Hate Crime?” they coax him out of the closet for good.

On the surface, the episode is a classic example of Always Sunny over-complication. The gang hires an arbitration lawyer to determine not whether a hate crime has been committed, but who is the rightful owner of a $2 scratcher ticket. It’s also a rare and hard-won instance of genuine heart as Mac, after years of in-the-closet jokes, sincerely comes out to his friends.

But on top of that, and probably most importantly, it’s a frank and uncompromising examination of language.

Aired during its usual cable slot gloriously uncensored (Rob McElhenney says it was worth every penny in FCC fines), the episode begins with one carefully placed “faggot” and then works its way through the pantheon of obscenity from there. The audience is treated to several “fucks,” “cunts,” and “cocksuckers,” and a single very blatant N-word.

This brings us to the show’s fraught treatment of race over the years. Because if there’s one thing the gang has been consistent about, it’s casual racism.

Just like the title of “Hero or Hate Crime?,” the episode’s one N-bomb is a callback to the show’s first season and, most likely, a deliberate demonstration of how far it’s come. In the show’s very first episode (aptly called “The Gang Gets Racist”), Charlie says the N-word. With a very hard r. He doesn’t mean anything by it, he tries to explain, and he’s only quoting a black acquaintance who said it first.

But the word’s prominence in the script (in 2005 it’s a funny misunderstanding as Charlie is “mistaken” for being racist) and its reception (Mac and Dennis don’t bat an eye when they hear it) are strikingly different in 2017. Because when Charlie says it again, with an equally hard r, all hell breaks loose. Even the gang, in all their awfulness, have an overwhelmingly negative reaction.

The episode acknowledges its roots and then disavows them. It accepts that even for people this bad, some things should probably be off the table these days.

It’s an interesting line to walk in a satire — the line between what the characters are willing to do and what the writers are comfortable having them do. And governing it all, in the end, is what the audience is going to keep watching. Always Sunny has done blackface not once but twice, but in both cases it’s explicitly a dubious decision made by the characters, and one that doesn’t even sit well with all of the gang.

It’s fitting that the first episode in question (in which Mac insists on looking a little too much like Danny Glover when they film Lethal Weapon 5) is called “Dee Reynolds: Shaping America’s Youth.” After a field trip to a screening of the gang’s movie, the only youth who’s been shaped at all is a student who shows up to school the next day in blackface. Both Dee and Charlie lose their jobs over it — a rare instance of real-world consequence for their actions. It turns out the gang’s stilted logic does not apply outside the bar.

Dee and Mac don blackface again for season 9’s “The Gang Makes Lethal Weapon 6,” and it’s even more jarring. But again, their attempts to get the film financed fail miserably when no real person will go anywhere near it. By season 11, even the gang distance themselves from it. In “Dee Made a Smut Film,” Dee shows Dennis an acting reel of all her appearances on film over the years… with one conspicuous exception. “It’s missing something, isn’t it?” Dee asks. “Nah, it’s great.” Dennis insists. It’s a rare meta-moment of the gang expressing the writers’ opinion that some things probably shouldn’t be brought up again. Always Sunny has almost definitely put its blackface days behind it.

And it notably passes up the opportunity in season 12, with the extremely ambitious premiere “The Gang Turns Black.” At once an indictment of racism in America and a full-fledged musical, it opens with the gang watching The Wiz and batting around every casually racist argument under the sun. It’s a bold start, but one that’s obviously a commentary on the kind of people they are even after all these years. Just like a lot of Americans, they’ve grown to be supportive of their gay friend but they still have a thing or two to say about Black Lives Matter.

Of course, this isn’t the episode’s real agenda. Following a freak electric blanket accident, the gang is transported into the bodies of five African Americans. For once, however, the visual humor is almost nonexistent — we and the gang still see their normal bodies. It’s only in the rare instance that they look into a mirror or we see another character’s perspective that we’re reminded of the change. Instead, most of the comedy comes from the bonkers fact that they’re also trapped inside a musical and singing against their will. After the sheer spectacle of seeing Mac and Dee in blackface in earlier seasons, it’s clear that our attention is being dramatically directed elsewhere, and something deeper is going on.

And it is. There’s a lot of uncomfortable humor to be found in the gang’s desperate grappling with their own racism. Determined to learn a lesson and appease the Freaky Friday-esque powers that be, they try and fail again and again to understand what it means to be black in America. And because they’re bad people, they manage to vocalize some pretty bad lessons along the way… That is until Charlie, in the body of a small child, is gunned down by the police when his toy train is mistaken for a gun. The gang declare that they’ve learned their lesson and want to go home.

It’s a hell of an image, and one that can’t really be misinterpreted.

In the end, it’s revealed that the entire episode has been the dream of Old Black Man, the poor homeless guy who’s been sharing a bed with Dee, Dennis, and Mac since they lost a bet in season 11. It turns out the non-dream gang didn’t learn a damn thing about racism, and we’re left with them evicting Old Black Man (whose real name, we’ve learned, is Carl) out into the street.

More than ever before, the show is determined to distance itself from its characters. The gang may be racist as hell, but the writers want us to know that they aren’t.

This brings us to a final perennial issue: sexual consent. “The Nightman Cometh,” one of the show’s most beloved episodes, is clearly about Charlie being molested as a child. And his never-ending love affair with The Waitress is one of unwanted advances and obsessive stalking that slowly ruin her life. But a lot like the gay jokes, the rape jokes have noticeably changed over the years.

In fact season 11’s surreal “The Gang Hits the Slopes,” in which the gang find themselves in a parody of the 1990 film Ski School and other sex comedies of the time, forcefully distances the show from its past flippancy. Partying with a perfectly sad and aging Dean Cameron, Dee and Mac are horrified by his outdated (but erstwhile mainstream) confusion between “pranks” and sexual assault. Charlie expresses the disparity very well: “Where I come from, jamming your dick through a hole in the wall, that’s assault. That’s a felony. And it’s just plain wrong.”

Of course, Paddy’s Pub has had a glory hole in its bathroom since season 4. But times have changed, both since 1990 and 2009, and even the gang admit it’s for the best. In the end, Cameron’s character is arrested for committing “a litany of sexual assaults.” As he’s beaten by the police, Dee and Mac agree that he probably deserves it.

That’s not to say the rape jokes are gone. But the way they’re delivered has changed. Just like the show’s homophobia has been gradually concentrated into Mac, its sexual deviancy has been channeled almost entirely into Dennis.

For a long time, Dennis has had highly questionable attitudes about women. His antics have spawned some of the show’s most memorable elements (the D.E.N.N.I.S system, the “implication”), and have also led many fans to deduce that he’s a serial killer. Because like Mac’s sexuality, Dennis’ creepiness has only gotten more and more explicit and outrageous over the years. Dennis hasn’t had feelings since he was 14, he keeps duct tape, zip ties, and gloves in his car in case someone has to “pay the ultimate price,” and his go-to symbol of love is a woman’s head in a freezer. Dennis is, almost definitely, a murderer and a rapist.

Unless he’s not. Because season 12 has shown Dennis as he’s never been seen before: as a human being.

In “The Gang Goes to a Water Park” Dennis bonds with a young girl he sees himself in, and he experiences what might be his first-ever relationship not tinged by sexuality or power. In “The Gang Tends Bar” he reveals, in a startlingly real moment, that he does actually have feelings — feelings we see in full force when Mac surprises him with a Valentine’s Day gift. (Granted, the gift is a rocket launcher, but that’s just the right amount of violent weirdness to make the moment still feel true to Dennis).

And of course the season 12 finale delivers the ultimate bombshell — after a heartfelt embrace with the son we never knew he had, Dennis decides to leave his old life behind and “be a dad.” The departure, according to the creators, may be for good.

Does this have anything to do with the current climate around sexual assault? It’s unclear, but a lot of things surrounding Dennis’ departure are being left unclear for now. However, in an interview with The Daily Beast, Glenn Howerton, who plays Dennis, said “I do think that it’s time for that character to change. I think he has to change. It was never really acceptable the way he behaved, and now it’s even less so in terms of how you actually can’t get away with it anymore.”

Granted, Howerton also has a new show on a different network. And after 12 years of devotion, it’s reasonable for an actor and writer to want to do something else with his life. But Dennis’ emergence of unprecedented humanity and his sudden realization that he can’t stand his old life anymore suggest that the show knows it can’t keep him like he’s been and stay relevant.

Howerton’s departure, whatever the cause, and whether it’s forever, brings up a valid point — it’s a tall order, in 2018, to write and perform a character who is a serial rapist… in a funny way.

Whatever it chooses to tackle in its next two (at least) seasons, It’s Always Sunny in Philadelphia is likely to do it well. It’s stood the test of time against all odds, and its willingness to adapt even while edging the line of acceptability has earned it a beloved place in our hearts, and in America’s understanding of itself over the past decade and a half.

Here’s to 12 more years. I sincerely hope it’s with Glenn Howerton back on board.