Part of the charm of How I Met Your Mother was the fact that it made constant callbacks to other sitcoms and TV series. It was a great source of comedy as well as a fun nod to the inspirations that helped make the series what it was. But the series took the whole premise to another level when it laid in a joke about one of the greatest sitcoms of all time and committed to it completely.

How I Met Your Mother had no problems making reference to other TV shows, particularly any series the stars had previously been in. Alyson Hannigan played Lily on the show but got her start in the world of Buffy the Vampire Slayer. Several actors also from that same world also popped up from time to time. And HIMYM made more than one reference to the series that started Neil Patrick Harris's career, Dougie Howser, M.D.

RELATED: The Big Bang Theory: Sheldon Has Some Interesting Phobias

But things went a step further than that. More than referencing the series its own stars had been on before, HIMYM also made references to other series. And in the case of one episode, that other series was Cheers. Generally recognized as one of the best sitcoms of all time, the show focused on the adventures of denizens of a Boston area bar and the former baseball player who owned it.

barney stinson from how i met your mother

Cheers served as the inspiration for a key joke in Season 2, Episode 7 of How I Met Your Mother. A young barista who was into Ted accidentally renamed Barney as Swarley by spelling his name incredibly wrong on his cup. As good friends do, the rest of Barney's crew immediately changed his name to Swarley and proceeded to call him that for the rest of the episode. They bombarded him with endless gags and pranks related to Swarley.

RELATED: It's Always Sunny in Philadelphia: Frank is the Worst Sponsor Ever

This all led up to one final gag to close out the episode. On Cheers, the entire bar would yell "Norm" when the world's most professional barfly walked in. Keeping that in mind, the rest of Barney's gang set up a similar situation at their favorite spot, MacLaren's. When Barney walked in, all of the staff and patrons yelled "Swarley" at the top of their lungs. It was the definition of rubbing salt in the wound.

What happened next was for the viewers and not Barney. The music from Cheers started playing, which he couldn't have possibly heard. And the closing credits that ran in this episode were the same as the ones that would have been seen at the end of Cheers years earlier. Obviously, Barney would not have been able to see the closing credits so this was all about maintaining the Cheers aesthetic for fans.

It was a solid joke that fit the moment perfectly. And completely fleshing out the vibe of Cheers with the music, font, and graphics only made it that much better. That being said, viewers who had never seen Cheers may have been a little confused by the gag. But for anyone who was familiar with it, this was a quick joke that was executed well and was honestly hilarious. Unfortunately, Swarley wouldn't have found it as funny.

KEEP READING: New Girl: What Happened to Coach?