The following contains MAJOR SPOILERS for Avengers: Endgame. We highly recommend you see the movie before reading. There are also spoilers for Star Trek episodes and movies, but those are old so you do you.

While on the press tour for Avengers: Endgame, Kevin Feige shared that his love of Star Trek influenced the film and the MCU in general. And oh boy, he wasn’t kidding about that.

Avengers: Endgame is replete with homages to the Star Trek franchise. Feige and the Russo brothers took some of the best elements from over fifty years of Trek’s greatest hits. Here are four major examples of how Star Trek’s legacy influenced Avengers: Endgame

Star Trek: The Next Generation 
How AVENGERS: ENDGAME Is A Love Letter to STAR TREK_1 The biggest Star Trek influence seen in the film is   the series finale of Star Trek: The Next Generation called, “All Good Things.” This classic episode is cited by many as one of the best series enders of all time. It found Captain Picard jumping through time, from the present to the future to the show’s past. He does so in an effort to to stop a spacial anomaly that threatens to consume the galaxy. Not only does the episode give us glimpses into the future of the Enterprise crew, it takes us back to the show’s earliest days as well. The entire episode is a celebration of seven seasons of the series, a love letter if you will. Sound familiar?

Avengers: Endgame takes this concept and ramps it up several notches. Like “All Good Things,” it begins in the present, then jumps several years into the future, where we find our heroes in very different places in their lives. Then it travels to the past, where we see our favorite characters as they were when we first fell in love with them (and before much of their character arcs). Endgame goes even further than “All Good Things” with time travel, though, as we explore several eras in the MCU’s history. But the fingerprints of The Next Generation finale are all over this movie.

Star Trek: Voyager
The 2001 series finale of  Star Trek: Voyager also has connections to the final Avengers movie. The episode title (“Endgame”) is an obvious one, but that’s not all. This episode introduces us to an older version of Captain Janeway, now Admiral Janeway, decades in the future. We discover that it took her 23 years to bring Voyager back home to Earth from being lost in space, which cost the lives of several of her crew members along the way.

Not willing to live with this failure, she travels back in time and confronts her younger self with a plan to bring her ship home much sooner.The older version of Kathryn Janeway often seems annoyed at her younger self’s righteousness and strict adherence to the rules. I immediately thought of this episode when an older Steve Rogers takes on his younger counterpart, annoyed by his past’s earnest naïveté.

Star Trek III: The Search of Spock
At the end of Star Trek II: The Wrath of Khan, Leonard Nimoy’s Spock dies saving the crew of the Enterprise in a poignant scene that remains one of the greatest in sci-fi cinema. The next movie, The Search for Spock, picks up months later. Admiral Kirk can’t let go of his “failure” to save Spock, and is willing to do “whatever it takes” to bring closure to the soul of his best friend. And to ultimately bring him back to life.

But much like it plays out for our heroes in Avengers: Endgame, the cost for bringing back the dead is high. Kirk destroys the original, beloved starship Enterprise, and loses both his son David and his rank as Captain. But he and his ever faithful crew are willing to make large sacrifices in an effort to set things right. Similarly, the Avengers succeeded in undoing Thanos’ snap….but at also at a very high price.

Star Trek VI: The Undiscovered Country

One of the most touching moments of Avengers: Endgame came as the credits were rolling. All of the original Avengers signed their names on screen like a high school yearbook, a way to bring closure and say farewell to their time in the franchise.

And yes, this exact same construct was used in the closing credits of 1991’s Star Trek VI: The Undiscovered Country. That film was the final journey of the crew of the original Enterprise, ending a saga which spanned the original series and six feature films over 25 years. When they all signed their names at the end, we knew we’d never see this crew together again, and it marked a true sense of finality.

Images: CBS / Paramount Pictures / Marvel Studios