Spoilers for Doctor Sleep follow below.

Throughout Stephen King’s long, illustrious career, there’s been a push and pull between fidelity to the source material and making sweeping changes when it comes to adapting his books and short stories into feature films. The most striking comparison is the 1997 miniseries adaptation of The Shining vs. Stanley Kubrick’s classic 1980 adaptation of the same book. King himself made his displeasure with Kubrick’s more dramatic, less supernatural adaptation known publicly, as the legendary filmmaker disposed with King’s explosive ending and more explicit ghosts in favor of a story about a man who slowly goes insane, then tries to murder his family. King felt the stripping down of Jack Torrance's character in favor of an experiential film about madness drained some of the tragedy from the story, and while Kubrick's film is indeed emotionally unsettling, you don't necessarily feel bad for Jack Torrance at any point.

Writer/director Mike Flanagan’s adaptation of King’s 2013 book sequel Doctor Sleep bridges the gap between King’s The Shining book and Kubrick’s film adaptation, serving as a satisfying sequel to both. This is especially potent in the Doctor Sleep movie ending, which deviates from King’s source material in favor of something that closely homages the iconic film—and yet also retroactively makes Kubrick’s film a bit more faithful to the book The Shining.

doctor-sleep-the-shining
Image via Warner Bros.

At the end of the Doctor Sleep movie, the adult Danny Torrance (Ewan McGregor)—son of Jack Torrance—has reunited with gifted youngster Abra (Kyleigh Curran) after a failed abduction by Rose the Hat (Rebecca Ferguson) and her cult of basically child eaters known as the True Knot. The True Knot are established as a band of gifted folks who also have “the shining,” but who have gained near-immortality by periodically eating the “steam” that comes out of those who have the shining. Unfortunately for the victims, the steam is only released when they experience fear or pain. This steam allows the True Knot folks to live long lives, but in order to obtain it, they have to hunt down, torture, and kill those who have The Shining.

So at this point in the film, all of Rose the Hat’s followers have been killed thanks to an ambush crafted by Danny, Abra, and Danny’s friend Billy (Cliff Curtis), the latter of whom was tragically killed during said ambush. Danny knows that Rose won’t stop coming after Abra, so he decides to lead her into a trap in the one place that just might be able to bring the vexing antagonist down: The Overlook Hotel.

As Danny explains it, The Overlook Hotel is full of ghostly apparitions who feed off of those who have The Shining. Since the fateful events of Danny’s childhood, he’s been trapping the Overlook ghosts in his mind—a trick that was taught to him by Dick Hallorann, who was played by Scatman Crothers in The Shining and who is played by Carl Lumbly in Doctor Sleep. Indeed, the opening of Doctor Sleep recaps the events of the end of The Shining, and if you’ll recall, young Danny called to Dick when his dad was going insane, which led Dick to venture up to the Overlook Hotel during the snowstorm. Once he entered the hotel, Jack Torrance cut him down with an ax, killing him.

doctor-sleep-ewan-mcgregor-redrum
Image via Warner Bros.

And yet, at the beginning of Doctor Sleep we see Dick talking to young Danny on a bench in the aftermath of the Shining events. You see, Dick is now also a ghost, having been killed at the Overlook, but he hasn’t come to feed off of Danny. He’s come to teach him how to trap the dangerous ghosts who will stop at nothing to come and find him.

The lesson is received all too well, which leads us to the ending of Doctor Sleep. Once inside the Overlook Hotel, Danny insists he needs to “wake it up,” referring to the now rundown building as a creature in and of itself. He first heads to the boiler room and turns some knobs, then starts making his way down very familiar hallways.

It’s during this “waking” period that Danny comes face to face with the ghost of his father Jack (now played by Henry Thomas) in the hotel bar, except Jack doesn’t introduce himself as Jack. He insists he’s merely a bartender at the hotel, and urges Danny—a recovering alcoholic who’s now sober—to take a drink. This scene mirrors a similar sequence in The Shining in which Jack Nicholson encounters a bartender in the same ballroom, who himself resembles the former caretaker of the Overlook—the one who murdered his family. It’s a cycle, you see. The caretaker is driven mad by the hotel, kills his family, and then becomes one with the Overlook, taking his place behind the bar.

After this harrowing encounter (during which Danny holds strong and doesn’t drink), Danny and Abra confront Rose the Hat near the iconic staircase from The Shining. Once pinned down, Danny unlocks all the Overlook Hotel ghosts from his mind, who then jump out and immediately start eating Rose the Hat’s steam, killing her in the process.

But while the ghosts dispatch with Rose the Hat, Danny is now vulnerable to their possession once more and essentially becomes his father—one of his eyes goes white, he grabs an ax, and he starts limping down the hallways searching and screaming for Abra. Once he finds her, Danny subdues the ghosts for just long enough to have a nice moment with Abra, insisting he must die with the Overlook while she runs away. You see, Danny turned the boilers on high, and the hotel is ready to go up in flames any minute now.

doctor-sleep-rebecca-ferguson-image
Image via Warner Bros.

This is an explicit nod to King’s version of The Shining, and is Flanagan’s attempt to bridge the gap between King’s source material and Kubrick’s adaptation. In that book, Jack chases his family around the hotel and comes face to face with young Danny, who insists he isn’t really his father, that it’s just a mask being worn by the hotel. Jack subdues the ghosts just long enough to have a nice moment with Danny, telling him and his mother to run. Indeed, in The Shining book, Jack neglects to relieve the pressure on the boilers, and The Overlook explodes just as it does in Doctor Sleep.

It’s no secret that Stephen King was unhappy with Kubrick’s adaptation of his book, and indeed Kubrick’s movie downplays the supernatural aspect while instead focusing on the slow descent into madness of Jack Torrance. There’s no boiler room, no explicit possession of Jack. Just a father slowly going insane, talking to people who aren’t really there, and eventually attempting to murder his family.

But since The Shining leaves the Overlook still standing, Flanagan had an “in” here to cull together elements from King’s books—both The Shining and Doctor Sleep—while using the visual language established Kubrick. The Doctor Sleep movie retroactively makes clear that Jack Torrance was indeed being influenced by the Overlook, but Flanagan also allows the audience to maintain that Jack was also going insane.

doctor-sleep-kyliegh-curran
Image via Warner Bros.

So much of Doctor Sleep is about providing aid to others who may be going through something you’ve experienced. When the film begins, Danny is an alcoholic deadbeat, going so far as to steal money from a drugged-out single mother. But when Bill meets Danny, he recognizes a fellow addict and immediately offers help, even vouching for him so he can rent a room. For the first 2/3 of the movie, Danny resists the pleas from Abra to communicate, and when she finally seeks him out, he tells her to run away and not tell anyone about her gift of “the shining.” Ever. Despite the fact that there are evil people out there murdering children.

What turns Danny around is one final visit from the ghost of Dick, who tells him he must repay a debt by helping Abra out. Indeed, in the events of The Shining, it was Danny’s call that brought Dick back to the Overlook, where he was killed. Dick unknowingly gave his life so that Danny could live, and so at the end of Doctor Sleep it makes sense that Danny then gives his life so that Abra—this young gifted girl who reached out to him for help—can live on.

At the very end of the Doctor Sleep movie we see Abra conversing with adult Danny in her room, only for it to be revealed that this is Ghost Danny coming to visit Abra; he did in fact die in the Overlook fire. In the film’s last scene, Abra finally tells her mother the truth—that she’s been conversing with a ghost—before heading into her bathroom to dispose of another one of the Overlook’s insidious ghouls, just as Danny did all those years earlier. The implication being that the cycle is now repeating, but with a stronger, more capable hero in Abra. When another gifted person inevitably comes along asking for help, or when other malevolent spirits who feed off of those who shine seeks her out, she won’t resist the call. She ain’t afraid of no ghosts.