All roads lead back to the Overlook Hotel for Dan Torrance (Ewan McGregor), the scarred protagonist of Doctor Sleep. Being a sequel to The Shining, arguably the best haunted house story ever told on the page and the big screen, this is the only way this story could end. But this ending is not all that it seems. While generally faithful to how Stephen King‘s sequel novel ends, it also brings into play the writer’s original, explosive conclusion to The Shining novel. Ultimately, this ending is a fusion of both what makes sense in King’s version of the story and the world created for the screen by Stanley Kubrick. Dan and little Abra Stone (Kyliegh Curran), a young girl with a very powerful Shine, are on the run from the vile Rose the Hat (Rebecca Ferguson), the last surviving member of a cult of energy vampires known as the True Knot. Throughout the movie, Rose and her gang have been hunting Abra, whom they intend to torture in order to feed off her psychic energy — “steam” — but this obsessive search for the young heroine has left all of Rose’s family dead. But she’s hellbent on finishing the job, no matter what. So Dan and Abra hatch a plan to lure Rose to the Overlook Hotel, a place that, like the villain of the movie, feeds off of psychic energy. Their hope is that they can trap Rose inside the hotel so that the spirits of this haunted place can feed on her. But the plan has a catch: Dan has to free all of the evil spirit he’s kept in his mental lockbox for the last few decades, which means that he’s likely to relive a few nightmares by the end of his second stay at the Overlook. Read More: Every Stephen King Movie and TV Series in Development Obviously, Mike Flanagan’s movie takes a few liberties with this ending. Not only is the Overlook Hotel still standing in this version of Doctor Sleep — following up on the ending of Kubrick’s movie — but Jack is anything but a friendly ghost in the final act. Dan does reunite with the spirit of his father in the movie, but this isn’t the Jack Torrance we know from The Shining. This is Jack taking the form of Lloyd, the Overlook bartender, played brilliantly by Henry Thomas (The Haunting of Hill House). Unsurprisingly, Lloyd welcomes Dan into the revived Gold Room and offers him a drink. This scene is haunting for more reasons than one. Not only is Thomas able to capture the manic eyes of Jack Nicholson as Jack Torrance but also perfectly embodies the creepy stoicness of Lloyd, who appears friendly at first before showing his true face as another hungry spirit preying on Dan. Needless to say, this is a far cry from King’s original intention for the ghost of Jack Torrance. Things only get worse when Rose arrives, although at first it seems Dan and Abra are going to score an easy win. The duo lures Rose into the Colorado Room, where they trap her inside Abra’s mind — which takes the form of the Overlook’s infamous hedge maze. Here we get to see Rose chase after Abra as Jack once chased Dan. It’s clearly a moment of fan service, as Abra gains the upper hand, using a knife to wound Rose. But just when Abra has Rose on the ropes, the villain is able to break free from the psychic trap and unleashes her wrath on Dan and Abra. The heroes are only able to defeat Rose when Dan unleashes the hungry ghosts of the Overlook, who feed on Rose. But the nightmare is far from over, as Doctor Sleep‘s true ending reveals itself. Dan, who probably knew that his return to the Overlook would also mean his doom, becomes possessed by the hotel. In a scene mirroring those at the end of The Shining, Dan hunts Abra with an axe. Here, McGregor comes as close as to emulating Nicholson’s performance as he will in the movie, as he limps his way down the long hallways of the Overlook, shouting Abra’s name, a maniacal smile on his face. Flanagan throws in a second twist in this climactic final chase, which is meant to not only mirror the end of The Shining movie but also the book, tying both universes together with a nice, bloodsoaked bow. In the final minutes of the film, Dan is able to escape the spirits long enough for one final selfless act that will not only save Abra but put an end to the power of the Overlook. Dan makes his way to the hotel’s boiler room, cranking the malfunctioning equipment until it explodes, setting fire to the entire building in the process. In a surprising turn of events, Dan meets his end much like his father did in the original novel, going down with the hotel itself. While Dan survives in King’s Doctor Sleep novel, having never stepped foot in the Overlook again, the movie’s ending seems more fulfilling overall, especially for fans of King’s The Shining. Flanagan wraps up the writer’s original ending into the finale of his movie, bringing both King’s and Kubrick’s visions to a close. This is perhaps the major highlight of the film — besides Ferguson’s stellar performance. Like in the book, Doctor Sleep features a short epilogue between Abra and Dan. Of course we know that Abra is talking to the spirit of Dan in the movie. In a few surprising final words, her dead mentor advises Abra to continue to use the Shine to help others as he once did while working at the hospice. Dan finally seems at peace with his powers, and Abra’s future looks bright, as she confronts the spirit of Mrs. Massey in her bathroom one last time. Read More: The Best Stephen King Movies As for what’s next for Abra, Flanagan leaves the ending a bit open-ended. As the director told us a few weeks ago, he and King have a plan for more projects in the future. Could one of these be a third Shining movie starring Abra? As the Overlook has already shown countless times before, the end is only the beginning. John Saavedra is an associate editor at Den of Geek. Read more of his work here. Follow him on Twitter @johnsjr9.