Bryan Singer gives the X-Men franchise, and his own career, a much-needed adamantinum shot in the arm.

(Warning: The following review contains spoilers)

It’s no accident that X-Men: Days of Future Past opens with a scene that echoes the opening moments of the very first X-Men film, in which a group of Holocaust victims walked to their deaths under the cold eyes of complicit soldiers. (Though, as the title implies, Future Past puts a futuristic spin on the sequence, setting it down in a post-apocalyptic landscape rather than World War II.) It’s also no accident that the movie’s central set-piece involves a well-organized plan to bust the series’ most interesting character—the part-villain, part-virtuous master of magnetism Magneto—out of a top-security prison a la the series’ first sequel X2: X-Men United. And finally, it’s no accident that Past ends with its cast of mutants coming face-to-face with the President of the United States on the White House grounds, again harkening back to X2.

The (if you will) X-factor that unites these three movies is the man behind the camera, Bryan Singer, returning to the franchise he launched some fourteen years ago after a checkered career as a gun-for-hire within the studio system. In his absence, the X-Men series has floundered through a mostly terrible trilogy capper (X-Men: The Last Stand), a woeful standalone (X-Men Origins: Wolverine), a pretty good prequel (X-Men: First Class) and a decent one-shot (The Wolverine). Singer’s main task, then, is to recapture the excitement and consistency of vision that was on display in the franchise’s early days, which in part explains why he’s so willing to raid his back catalogue for ideas. Meanwhile, thanks to the movie’s time travel element, he’s also able to write out huge chunks of post-Singer X-mythology (like, say, the majority of The Last Stand, most notably that stupid “mutant cure” plotline) in order to offer his preferred version of events. As a result, Days of Future Past is perhaps best described—with due respect to Dan Harmon and Community—as a “re-pilot,” one that sometimes skillfully and sometimes awkwardly weaves together what audiences already know and like about the series with new plot and character threads designed to open up its future.

Beyond its specific callbacks to X-Men and X2, Future Past is also reminiscent of Singer’s earlier movies in its ungainly plot structure and momentum-killing bouts of exposition, which have only grown more pronounced with passage of time and the appearance of such swifter, nimbler Marvel movie fare as Sam Raimi’s Spider-Man and Jon Favreau’s Iron Man. At the same time, though, it also restores elements that have been largely absent—and much-missed—from the franchise since his departure, including an obvious understanding of and respect for the Big Idea behind Marvel’s band of mutants (namely the way they function as a stand-in for any minority that’s viewed with prejudice and ignorance by the larger majority), as well as set-pieces that avoid the organized chaos that dominate so many big-budget spectacles by rooting the action in specific character abilities. The raid on the White House that opened X2, for example, was so thrilling precisely because it was intentionally designed to showcase the powers of blue-skinned teleporter Nightcrawler (one of the few characters who doesn’t reappear in Future Past, even in a passing cameo). Here, Singer equals and maybe surpasses that scene with a terrific sequence based around franchise newcomer, Quicksilver (Evan Peters), who uses his super-speed to literally run rings around a group of Pentagon security guards bent on halting Magneto’s prison break. It’s a rip-roaring crowd-pleaser that reminds us of how effective a showman the director can be when he cuts through the storytelling clutter and connects one-on-one with a mutant.

Unfortunately, there’s a lot of storytelling clutter present in Days of Future Past, a side effect of having to service its giant cast while also rewriting the franchise’s history. The short version of events is that, in that post-apocalyptic future glimpsed in the opening scene, mutantkind is on the verge of extinction thanks to armies of giant robots known as the Sentinels. So the newly reteamed Professor Xavier and Magneto (Patrick Stewart and Ian McKellen, dutifully suiting up for duty and a paycheck) send Hugh Jackman’s Wolverine back through the timestream to inhabit the mind and body of his younger self, with the hopes that he’ll be able to convince lil’ Professor X and Magneto (James McAvoy and Michael Fassbender) to put aside their differences and prevent the darkest timeline from coming to pass. Doing so requires that they find a way to stop a rogue Raven a.k.a. Mystique (Jennifer Lawrence) from killing the inventor of the Sentinels, Bolivar Trask (Peter Dinklage), an action that, far from preventing the robotic assassins’ ascension, actually hastens in the apocalypse.

Mystique’s elevation from mostly silent henchwoman (her designation in the first two X-pictures) to key mythology player is one of the post-Singer franchise tweaks that’s actually clicked, so it’s nice to see that the director retains that here. (Granted, it helps that the character’s now played by the world’s biggest movie star, rather than a model-turned-actress.) He also benefits from the First Class team’s inspired decision to pit McAvoy against Fassbender, as the duo continues to function as a compelling and absurdly charismatic pair of frenemies. (They’re far more engaged in the proceedings than either of their seniors, although, to be fair, the movie really doesn’t ask Stewart and McKellen to do much more than show up.) On the other hand, Singer’s decision to force Wolverine into the proceedings doesn’t really pay off, which is surprising considering the fact that the then-unknown Jackman was the standout star of the original X-Men. Perhaps his two solo adventures have taken their toll, because the actor has trouble integrating himself back into this ensemble, for reasons that aren’t simply due to the fact that Wolverine is meant to be a mutant out of time. (But hey, at least Jackman is more energetic than Halle Berry’s Storm, whose brief reappearance here only serves to remind us how useless she was.) And while Singer gives Quicksilver a rousing introduction, the other new mutants don’t make much of an impression, mostly serving as Sentinel cannon fodder so that the established stars can live a little longer.

And yet, even with its various stumbles and shortcomings, Days of Future Past provides consistently earnest and entertaining comic book movie spectacle that, for me at least, was preferable to both The Amazing Spider-Man 2 and Captain America: The Winter Soldier. (The latter had a great first hour before tapering off midway through, while the former offered only a few moments of stand-out Spidey action amidst a relentlessly dumb plot.) In fact, the movie gave me a renewed appreciation for Singer’s accomplishments with the first two X-Men film, which I had downgraded in the intervening years thanks to more seemingly substantial achievements like Christopher Nolan’s The Dark Knight series and Joss Whedon’s The Avengers, as well as the director’s own misfires like Superman Returns. While all three suffer from too many moving parts, they also sidestep the slavishness to the source material that can often impede comic book adaptations and always strive to root the events—and the action—in character rather than a faceless master plot. The directors who clamber aboard these movies often like to boast that they’ve read the comics on which they’re based, but Singer actually seems to understand the comics and uses that to inform his own distinct, if sometimes distinctly flawed, vision.