Tony Stark’s failing health was a major plot point in Tony Stark is one of the smartest characters in the MCU, and while his genius is largely expressed through his engineering skills, he is also a brilliant tactician, putting his skills to use against supervillains and in tandem with his Avengers teammates. While much of Stark’s behaviors in Iron Man 2 are seemingly reckless, others likely served the purpose of setting up his legacy before he died.

Iron Man 2 wasn’t quite as well-received as its predecessor, nor did it feature the same controversial plot twist as its successor, making it stand out within the Avengers: Endgame.

Related: How Far Iron Man Moved Avengers HQ From Stark Tower

A particular moment in Iron Man 2 indicates that Stark was already preparing for his demise by palladium poisoning by the time the film began. James “Rhodey” Rhodes easily accessed the Mark 2 Iron Man armor, which would have been an uncharacteristic security oversight if Stark didn’t wish it to be so, and he used the suit against Stark with astounding skill, despite Tony’s trial-and-error training shown in 2008’s Iron Man. Tony most likely trained Rhodey to use the armors between the two films, ensuring that his armor would end up in trustworthy hands when he died, which is consistent with his other behaviors in Iron Man 2 and his subsequent MCU appearances.

Iron Man and War Machine fighting Whiplash.

Avengers: Age of Ultron, where the Iron Legion also protected civilians during The Avengers’ battle with Hydra forces in Sokovia.

Stark’s preparations were finally put to the test in Rescue armor for Pepper Potts and gave access to his network of drones and ordnance to Peter Parker via E.D.I.T.H. and his pair of advanced sunglasses. While the former worked, the latter was controlled by Mysterio for a time due to his manipulation of Spider-Man. The first example of Stark’s backup plans being set up, however, was giving training for and access to his Iron Man armors to Rhodey before the events of Iron Man 2.

Next: Iron Man 3: Why Tony's "Perfect" Armor Looked So Weak