WARNING: The following contains spoilers for It: Chapter Two, in theaters now.

Stephen King is one of the most iconic modern horror writers. The author has been responsible for over sixty novels and more than two-hundred short stories across a career that has spanned more than 50 years.

He's also the mind behind any number of scary classics, including It. Centering around a demonic, shape-shifting monster that typically takes the form of a clown, the narrative has been adapted into both a television miniseries and a two-part film adaptation. But that doesn't mean the writer is perfect, with one consistent criticism dogging him for years.

The author appears in It: Chapter Two in a very well-placed cameo that pays reference to that criticism, and as a result, is a pretty perfect one.

RELATED: It Chapter Two Director Says There's Enough Mythology for Another Sequel

While exploring Derry to try and find the "token" he needs for a ritual the Losers will use to contain Pennywise (Bill Skarsgård) after it returns to the town, Bill (James McAvoy) finds himself outside of an antique shop, looking at one specific item in the window.

Inside, the owner of the store is selling the bicycle that Bill used to own as a child. Walking inside, he accidentally curses in front of the shopkeep, getting Bill reprimanded. The owner continues to be unimpressed by Bill, even though he had copies of his work on his desk. Realizing he's a wealthy writer, the store owner ends up charging Bill $300 for the rusting bike. Naturally, the shopkeeper is played by Stephen King.

King even pokes fun at himself in the scene. The entire film has a running gag about how Bill never writes good endings. Multiple characters call him on it. When Bill asks the shop owner if he'd like the book to be autographed, the shop owner refuses. He says the ending was terrible before walking over to help get the bike for Bill.

It's a clever meta-joke on King's own history in the real world as a writer. Coupled with his annoyance at cursing (which, along with violence and sexuality, frequently appears in Stephen King books), it's a clever play on the author and the legacy of his stories.

RELATED: It: Chapter Two Tracking For A Monster (Clown) Opening Weekend

stephen king under the dome suffer the little children

King has been frequently criticized for the abrupt endings of many of his works. Even It has been ridiculed in the past for taking the creepier aspects of a shapeshifter transforming into living nightmares and then having him just turned into a spider for the big final battle of the novel. But while it's a decent running gag to play through the film, it takes on an extra layer of comedy when even King appears to complain about how bad his endings are.

Cameos can be tricky, and incredibly distracting if not done well. King appearing in the film to poke fun at his own faults gives the sequence a lighter, more memorable tone. It helps, too, that it has a natural place in the story, making it actually stand out as an organic moment. It's closer to a Stan Lee cameo in a Marvel film more than any of King's previous appearances in films based on his work, and it's a nice one.

It: Chapter Two stars Bill Skarsgård, James McAvoy, Jessica Chastain, Jay Ryan, Bill Hader, Isaiah Mustafa, James Ransone, Andy Bean, Teach Grant, Jess Weixler, Will Beinbrink, Xavier Dolan, Jaeden Lieberher, Sophia Lillis, Jeremy Ray Taylor, Finn Wolfhard, Chosen Jacobs, Jack Dylan Grazer, Wyatt Oleff and Nicholas Hamilton.

KEEP READING: Review: It: Chapter Two Is Entertaining, If a Bit Bloated