This article spoils the entire plot, and twist ending, of Split.

M. Night Shyamalan is a writer and director who is legendarily fond of the surprise twist ending. It was a stunt that made his career with his third film, The Sixth Sense, in 1999, turning a small-scale ghost story into a word-of-mouth smash hit that dominated the box office for an entire summer. He’s deployed it over and over throughout his career, to arguably diminishing returns, before dropping it entirely. But recently, as he’s dipped back into the horror genre that put his name on the map, he’s brought back his favorite gimmick, and his new film Split has a final reveal that is too bonkers not to discuss—one that redefines the overall thrust of the film, and that ends up referring back to his larger oeuvre in an unconventional way.

Shyamalan has always enjoyed playing with broad genre tropes—The Sixth Sense is a ghost story, Unbreakable is a superhero movie, Signs an alien invasion film, Lady in the Water an outlandish piece of high fantasy. Split takes two traditional premises and mashes them together: Three girls get kidnapped and locked in a basement by the villainous Kevin, and he (James McAvoy) turns out to have a heightened, fictionalized version of dissociative identity disorder, housing 23 “distinct personalities” in one body and warning that a terrifying 24th personality is on the way. The film plays out as tense thriller more than jumpy horror, as Casey (Anya Taylor-Joy) tries to negotiate her way to freedom by playing the personalities off of each other.

Split plays around with themes of mental illness and trauma in a very schlocky manner, and the patience you might have for that will vary wildly from viewer to viewer. But it’s the final minutes of the film that are sure to prompt the most head-scratching debate, as Kevin’s monstrous “beast” personality finally emerges and he begins rampaging around the city, able to crawl the walls and seemingly invulnerable to attack. It’s suddenly like something out of a comic book: Kevin monologues to himself about his newly developed power, and professes an outlook for humanity where only those like him—people who have suffered deep trauma—are worthy of survival.

Then we cut to a local diner, where news of Kevin is spreading on the television, with reporters giving him his very own villainous name, “The Horde.” A customer remarks that it reminds them of another person, “that guy in the wheelchair,” not recalling his name. The camera then pans over to David Dunn (Bruce Willis), who grunts, “Mr. Glass,” before taking a sip of his coffee and leaving. Dunn, in case you forgot (and, one assumes, most filmgoers have), is the lead character of Shyamalan’s 2000 film Unbreakable, a bleak subversion of the superhero genre that has since then become one of his best-remembered films (Mr. Glass was its Lex Luthor-like villain, a wheelchair-bound, brittle-boned mastermind played by Samuel L. Jackson).

It is a bizarre, daring thing to do—to have the twist to one movie be that it was, in fact, a quasi-sequel to an entirely different movie, one that was seen as a relative box office disappointment when it was released nearly seventeen years ago. For fans of the Shyamalan filmography, it’s a delight—a daft throwback to an underrated film that could serve as a tease for a future sequel, in which David Dunn and “The Horde” do battle. For everyone else, it’s a more forgettable curio, a strange cameo from a recognizable movie star that seems entirely unrelated to the preceding two hours of action.

Shyamalan said he had planned it that way for a long time, first developing the split-personality villain Kevin as a possible foil for the nigh-invulnerable David Dunn in the original Unbreakable. “I had about 15-20 pages written [focusing on Kevin] and those scenes are all in [Split],” he told io9 in an interview. When he began developing Split, he wondered if he could make it “a sequel they don’t realize is a sequel … [that] plays like a thriller and becomes an origin story,” and pitched Willis on the cameo (the actor, who has long expressed interest in making another Unbreakable, immediately agreed). If the reveal works, it could lead to another film, which Shyamalan says he hopes will happen. “I don’t know what’s going to happen when I go off in my room, a week after this film opens, to write the script. But I’m going to start writing,” he told Entertainment Weekly in another interview.

In a world where “cinematic universes” have become commonplace, any brand name, no matter how faded or niche, suddenly has more cache. When Unbreakable came out in 2000, it grossed $95 million domestically and $248 million worldwide, a healthy take that was nonetheless far off from The Sixth Sense’s bonanza the year before ($293 million domestic, $672 million worldwide). A sequel then would have been outlandish, but now, studios are more willing to bet on any property that might be recognizable to audiences—how else to explain a planned Tetris trilogy of films, or the return of the Power Rangers, or the fact that both Underworld and Resident Evil are releasing sequels this month?

But beyond the business implications, the twist re-contextualizes Split in a very interesting way, slyly (and, some might argue, cheaply) sidestepping some of the film’s more uncomfortable themes. Kevin’s mental illness, a ridiculous inflation of the already-controversial dissociative identity disorder, makes more sense as the origin of a supervillain’s powers—in fact, it’s not unlike that of the X-Men character Legion, a mutant with multiple personalities, who has his own show on FX starting next month. Split simplifies issues deserving of more complex examination, but that’s a hallmark of the golden-age comic books Unbreakable paid homage to. That film had Split’s dark tone, while retaining the pulp sensibility of a superhero story. In a Hollywood now overrun with a more corporate, audience-friendly brand of blockbuster do-gooders, it’s the right time for something stranger to exist alongside them. That is Shyamalan’s ultimate gambit.