An inescapable feeling of melancholy hangs over Star Trek Beyond, the third installment of the rebooted Star Trek franchise which began production with one devastating loss and ended with another. And yet, dedicated to the late Trek icon Leonard Nimoy and cast member Anton Yelchin, who died tragically less than a month ago at the age of 27, the film rings even more with a feeling of optimism and a message of hopefulness for the future: live long and prosper, for as long as we’re all on this rock together.

Like all existential malaises it begins quietly, in darkness. Somber horns wail the iconic Star Trek theme as Beyond opens on Chris Pine’s eyes, blue like planets, in the middle of another mission of star-trekking stewardship on behalf of the Federation. Back on the Enterprise he sighs, alone. The endless vastness of floating around the stars on job after job has taken its toll on Kirk. “It’s beginning to feel a little… episodic,” he deadpans to himself into another jaded Captain’s Log. Diagnosis: space ennui.

But there’s more to Kirk’s weariness than boredom. On the eve of every adult’s annual crisis—his birthday—Kirk wonders how he’ll ever be a hero worthy of his late father (Chris Hemsworth, who went on to become Thor after dying a hero aboard the USS Kelvin). James Tiberius is getting older, feeling the grind on the 966th day of a five-year tour. Has he achieved enough? Is he enough? Did he ever even want to be a hero, or was he only trying to prove he could join Starfleet?

His right-hand bestie Spock (Zachary Quinto), meanwhile, has called it quits with Uhura (Zoe Saldana), but is plagued by his own private crisis of self. Sad news about the elder Spock Prime (Leonard Nimoy) sends him into a tailspin, his human side haunted by the legacy of his Vulcan half. When you’re sharing your universe with the G.O.A.T. from another timeline, how can you ever know you’re living your best Spock life?

Directed by Fast & Furious franchise savior Justin Lin from a script by Simon Pegg and Doug Jung, the J.J. Abrams-produced Star Trek Beyond does some much-needed course correcting after the heaviness, and heavy self-involvement, of Star Trek Into Darkness. Its zippy self-contained story strikes a rollicking pace, doesn’t tip its hand, and sees the bigger picture: if franchise moviemaking is a marathon, Pegg, Jung, and Lin understand that you have to create a runway for future films to explore.

Where Into Darkness overdid it on the interpersonal crew drama and toyed masochistically with fan expectations (“Abraaaaaaaaams!”), Beyond reminds us how it used to be done. It’s a Star Trek: TOS adventure in the skin of a 21st century blockbuster, striking a throwback feel while allowing the new timeline’s cast to make these iconic characters more their own, an enjoyably watchable installment that opens up the rebooted Trekverse.

On the 50th anniversary of the beloved sci-fi property, you can finally imagine that this crew has their own vast canonical future to explore, freed from the shadow of the OG crew that preceded them. Kirk is right: it feels episodic, and that’s a good thing.

As the third film in a rebooted franchise that Paramount and J.J. Abrams clearly intend to keep on Trekking, that serves a vital purpose: the crew of the Enterprise ventures into an uncharted pickle, meets a new adversary intent on upsetting the order of post-Federation life, and must come together to save the universe and each other so that they may live to do it again another day. Like Lin’s Fast & Furious movies, Beyond latches onto a central theme of #family—a sense of family between crewmembers, new allies, progressive society, and all life in the galaxy by extension.

On this particular adventure, everyone’s problems converge when the Enterprise is called out of a mid-mission docking aboard the utopian spaceport Yorktown, a floating city emblematic of Federation ideals where alien cultures live together in peace. (It’s also where Sulu lives off-mission with his husband, whose same-sex family we glimpse in a perfectly casual moment, Mr. and Mr. Sulu’s arms locked in a tender embrace as they stroll away with their young daughter.)

Heading into uncharted space to rescue the crew of a ship in distress, Kirk’s crew is ambushed by an armada of powerful new enemy aliens whose coordinated attacks pummel the mighty Enterprise, taking its crew by surprise. “Slit its throat,” growls a hostile alien leader named Krall (Idris Elba). His hordes shred the Enterprise to pieces within minutes, unleashing a spectacular symphony of destruction that verges on sensory overload for eyes not accustomed to our post-Michael Bay era of VFX hyper-action.

It’s a symbolic decimation and one that smartly scatters the crew into far-flung directions, sending new pairings off into their own mini-adventures. Kirk and Spock’s torrid BFFship, for one, has hogged the spotlight enough. Here it’s Spock and Bones (Karl Urban) who get a chance to bond, stranded on the rocky planet Altamid together while Uhura and Sulu are captured by Krall’s scaly goons and Kirk is left to crash-land the remains of the Enterprise with the plucky Chekov (Yelchin), whose youthful energy and optimism is just what the weary captain needs.

Elsewhere among those rocks, Scotty (Pegg, writing himself a juicier part than in the first two films) meets Jaylah (Kingsman’s Sofia Boutella, in a standout turn), a tough alien chick with high tech snares, lethal combat skills, and a defiant love of rap music (“I like the beats and shouting,” she explains matter-of-factly, one of several lines that makes her the most quotable new addition to the Trek universe).

The planet Altamid is reminiscent of the dusty expanse of Cestus III, where Bill Shatner’s Kirk battled the Gorn in one of Star Trek: The Original Series’ most famous early episodes. Here Krall has amassed a collection of intergalactic prisoners as he plots doomsday designs on the Federation, the kind of violent terror attacks that resonate particularly strongly in our age of global distrust and paranoia. But there’s a more purposeful design to Krall, played with menace and roiling gravity by Elba beneath layers of prosthetics, that give Beyond a more complex and pointed thrust of relevancy.

It’s an awful lot of plot, character, history, and future for Lin to balance, and some characters, namely Uhura and Chekov, are underserved by the scattered focus. But when Beyond soars, it hits a sweet spot of perfectly balanced stakes, momentum, character development, callbacks, music, and action, blasting at full power in particular in one memorable space-battle set piece that punches in just the right moments.

Unfortunately a lot of the technical gobbledygook of Star Trek Beyond—Krall’s biochemical weaponry, Jaylah’s handy alien gadgets—get lost in the shuffle, and a lot of connective tissue feels like it’s been left on the editing room floor as Lin tries to keep a handle on the disparate paths, both emotional and geographical, of a half-dozen characters. When Krall turns his deadly designs on releasing black goo death vapors inside Yorktown, the film doesn’t bother trying to explain how any of its sci-fi science works, exactly.

What it does do is warp drive the film into its bigger picture concerns. It’s sheer coincidence that Beyond hits theaters on the heels of the U.K.’s Brexit vote, a parallel that Brit national Pegg has vocalized with dismay in recent weeks. As it opens stateside during a particularly volatile election year marred by shocking acts of violence and tragedy at home and abroad, those themes hit harder.

The real villain, Beyond says, is the one violently opposed to the possibility that yesterday’s enemies might become tomorrow’s allies. Harkening back to the moral progressivism Gene Roddenberry planted into the foundation of Star Trek half a century ago, it tells us that there is strength and hope in unity. Whether or not we go boldly forward is up to us.

That’s not to say Beyond isn’t a deeply melancholic outing for Trek fans, and an Enterprise crew who won’t ever be the same again. Pegg and Jung’s script pays sweet homage to Nimoy and the indelible mark he left on the franchise. But the unexpected loss of Yelchin, who was 19 when he filmed his debut as Russian navigator Pavel Chekov in 2009’s Star Trek, makes Beyond a heart-aching watch.

It remains to be seen how the franchise addresses Yelchin’s absence in future films as Abrams & Co., like the rest of us, surely imagined he’d still be around for many, many more years. You find your attention drifting to his wide, inquisitive eyes and expressive face, even when he’s just in the background of someone else’s scene, or off to the side at his post on the Enterprise consoles, or flirting with girls in the ship’s halls. The buoyant enthusiasm he brought to the young Chekov emanates in every second he’s onscreen, paying tribute of his own to his predecessor on the hallowed Enterprise bridge, Walter Koenig, with every woozily garbled “v.” As an unplanned farewell it’s a powerful record of how much life he gave to the camera in every minute of screen time.