It didn’t take long for National Security Adviser John Bolton to be frustrated by Donald Trump and, subsequently, join the effort to contain him. Bolton, an uncompromising hawk, was expected to become an authoritative figure in the White House. Instead, he has found himself somewhat sidelined in an administration where the president is loath to follow anybody’s counsel except his own. And so Bolton, it seems, has adapted the techniques of his predecessors: working around Trump, where he can, to keep international relations intact.

Bolton learned the value of circumventing the president early, when Trump refused to endorse a joint statement at the G7 summit in Canada, leaving some of America’s principal economic partners fuming. Fearing a repeat at the upcoming NATO summit, Bolton reportedly led a contingent of senior administration officials in an effort to finalize a formal policy agreement with allies before Trump arrived at the forum. According to accounts from five senior American and European officials who spoke with The New York Times, Bolton sent a demand to NATO Ambassador__Kay Bailey Hutchison__ for the alliance to reach an agreement before Trump took off for Europe. During a meeting of ambassadors on July 4, NATO Secretary General Jens Stoltenberg iterated Bolton’s objective to the delegations, tasking them with completing their work by July 6—five days before the start of the summit, the Times reports.

Despite Trump’s alliance-rattling antics in Brussels, Bolton’s effort paid off. The summit declaration achieved a series of critical goals—Macedonia will be formally invited to join NATO; an Atlantic Command post in Virginia will be established to coordinate an alliance response in the event of a Russian attack on an ally; and members pledged to buttress their militaries by 2020. “When you read the communiqué, and take into account the work that took place, this is one of the meatiest NATO summits that I can recall,” Deborah Lee James, a former secretary of the Air Force in the Obama administration, told the Times. The president reportedly did not read the 23-page NATO declaration in full. Instead, he was informed of the broad strokes of the agreement by U.S. officials.

Of course, the ongoing efforts of administration officials to control the president are only ever effective for so long. (Economic adviser Gary Cohn famously left the White House after losing his battle to keep Trump from starting a trade war; H.R. McMaster and Rex Tillerson similarly departed after their attempts to keep U.S. foreign policy on the straight and narrow put them in the dog house.) Within a week of the NATO summit, Trump called into question his commitment to Article 5 of the NATO charter, the principle that an attack on one alliance member is an attack on all. When Fox News host Tucker Carlson asked the president during an interview why he would send his son to defend Montenegro, Trump responded sympathetically. “I’ve asked the same question. Montenegro is a tiny country with very strong people,” the president said. “They’re very aggressive people. They may get aggressive, and congratulations you’re in World War III.”