Special counsel Robert Mueller faces a unique challenge in his investigation of Russian influence during the 2016 election. In addition to gathering information and prosecuting criminals, he has had to avoid getting fired by his resentful, mercurial, and unscrupulous commander in chief.

Fifteen months into the investigation, he appears to have done a masterful job. By manipulating and distracting Donald Trump and his team of lawyers, he has not only preserved his job, he has maintained complete autonomy and seeded a cluster of spinoff investigations that will be nearly impossible for the White House to stifle. And despite Trump’s insistence that he’s “totally allowed” to intervene whenever he chooses, he won’t dare make a move this close to the midterm election, which means Mueller’s investigation will be protected for at least three more months.

How has he done it?

1) No leaks. Whenever the media reports new revelations about Russian collusion, Trump flies off the handle, publicly attacking the investigators and privately exploring ways to terminate the investigation. Had Mueller and his team revealed their discoveries to the public, an enraged Trump would have them shut down long ago, consequences be damned. But the investigators have been extraordinarily tightlipped and leak-free, dripping out only the minimal information necessary for legal filings. The public doesn’t know what Mueller knows, and more importantly, neither does Donald Trump.

2) Soft rollout. It’s notable that Mueller has not indicted or even questioned any members of Trump’s family, including Donald Trump Jr. and Jared Kushner, who sought dirt on Hillary Clinton from a Russian operative. Publicly targeting anyone too close to Trump would certainly provoke a forceful reaction from the president. Instead, Mueller has prowled the outskirts, taking down stragglers like George Papadopoulos, Michael Flynn, Rick Gates, and Paul Manafort, before he goes after the main herd.

3) Obstruction distraction. As far as the White House knows, Mueller is investigating Donald Trump for one and only one violation—obstruction of justice. Without evidence of another crime to cover up, Trump’s lawyers believe they can beat the charge. As a result, they have been pleasantly cooperative, even allowing White House counsel Don McGahn to be interviewed for 30 hours over nine months. Mueller has encouraged the credulous lawyers by hinting at a swift resolution that always seems to be just a few weeks away. This subterfuge has taken in the old guard and the new; both Ty Cobb and Rudy Giuliani repeatedly promised that the obstruction of justice probe was nearing its end. Meanwhile, the Mueller team has quietly pursued all its investigations without interference.

4) The interview game. Mueller has been seeking a presidential interview since at least August 2017. For the past year, Trump and his lawyers have made a grand show of negotiating conditions for such an interview. They believe that prolonged wrangling benefits the president—making it appear as if he’s willing to speak with Mueller while avoiding actually doing it. In reality, the long delay is a boon for the investigators, allowing them to continue their work while Team Trump focuses on the optics of the interview negotiations. When the time comes, Mueller may subpoena the president, but doing so could trigger a legal crisis that could end the investigation, so he’ll likely wait until the last possible minute to issue a subpoena.

5) Diversification. When Mueller was hired in May 2017, there was only one investigation. Now there are at least three spinoffs, all run by separate divisions of the Justice Department. The Southern District of New York is investigating Trump’s former lawyer Michael Cohen for bank fraud, tax fraud, and campaign finance violations. The FBI’s Counterintelligence Division has charged suspected Russian spy Maria Butina for illegally acting as an agent of a foreign government. Finally, the department’s Public Integrity section is investigating Trump fundraiser Elliot Broidy for influence peddling. Broidy is an associate of Trump, a client of Cohen, and a former business partner of George Nader—a key witness in the main Russian investigation. And there may be more investigations to come. Even if Trump eventually finds a way to fire Mueller’s team, it will be legally and politically difficult for him to stamp out all the spinoffs. Mueller’s ghost would continue to haunt the White House even after the primary Russian investigation has ended.

The most critical moment for Mueller will likely come after the election on November 6. If Republicans maintain control of Congress, an emboldened Trump may feel confident enough to finally rid himself of the scandal that has been agitating him since he took office. On the other hand, if Democrats capture the House, a desperate Trump may attempt to quash the investigation before the new term begins in January. But even if he acts in November, it may be too late. By then, Robert Mueller will have had a full year and a half to investigate the misdeeds of Trump’s campaign and administration. Judging by how the special prosecutor has outfoxed the president so far, Mueller likely has a plan to ensure that his work will bear fruit. His report, in whatever form it eventually comes to light, will lay out all the charges that the investigators have kept secret so far, and no one in Trump’s inner circle will be spared, not even Trump himself.