US District Judge Alison Nathan has approved the proposed settlement between Tesla CEO and chairman Elon Musk and the Securities and Exchange Commission. The clock has now officially started on the various terms of the settlement, meaning Musk will soon no longer lead the company’s board of directors for the first time since he took the post in 2004.

Musk has 45 days to resign as chairman of Tesla. After he does, he won’t be able to step back into that role for three years. Tesla has to replace Musk with a new chairman within that same time frame, and it has 90 days to name two independent directors to the company’s board. Musk and Tesla have 14 days to pay equal $20 million fines, which the SEC says will be “distributed to harmed investors under a court-approved process.” Both Musk and Tesla can ask the court for extensions on these timelines.

Musk can’t become Tesla’s chairman again for three years

The company also has to employ a lawyer who will oversee all of Musk’s communications, including his tweets. This person will have to pre-approve any message coming from Musk that could have a material impact on the company’s stock price. Also as part of the settlement, neither Musk nor Tesla is able to publicly admit or deny any of the charges in the SEC’s suit.

The SEC and Musk agreed to the settlement on September 29th. This came just two days after the agency sued Musk in the Southern District of New York for his abandoned attempt to take Tesla private. The SEC claimed in the suit (among other things) that Musk’s August 7th tweets about having the “funding secured” to take the company private again were “false and misleading,” and he “caused significant confusion and disruption in the market for Tesla’s stock and resulting harm to investors.”

The commission arrived at that decision after spending most of the month of August investigating the failed privatization attempt. The complaint filed on September 27th leaned heavily on internal communications between Tesla’s CFO, its head of investor relations, and other high-ranking employees.

The SEC argued that these subpoenaed records showed that, while Musk had held multiple meetings with Saudi Arabia’s Sovereign Wealth Fund, he had “no specific deal terms” and nothing in writing when he announced his intentions on August 7th. (Musk said later in August that the “funding secured” tweet was a reference to an expected deal with the Saudi wealth fund.)

Musk did tell Tesla’s board of directors about a possible buyout in the days before he announced the plan on Twitter, but the SEC said he didn’t tell the company, the board, or even NASDAQ that he was going to make the idea public. Even Tesla’s head of investor relations was left in the dark; records show the employee sent a text to Musk’s chief of staff minutes after his first tweet asking whether it was “legit.” Musk eventually announced Tesla would remain a public company on August 24th.

The SEC wrapped its investigation in late September and proffered a deal with Musk and Tesla. That first settlement would have forced Musk to step down as chairman of Tesla for two years and pay a $10 million fine. The two sides were reportedly close enough to finalizing the deal that press releases were being drafted. But Musk walked away from it at the last minute. He reportedly chafed at the idea of not being able to publicly state he did nothing wrong. And he also threatened to resign if Tesla’s board of directors didn’t back his decision to fight the case, according to The New York Times.

Hours after Musk turned down the original offer, the SEC filed its suit in the Southern District of New York. The commission sought to permanently ban Musk from holding any officer or director positions with publicly traded companies. Two days later, the warring sides reached a settlement.

This is not the end of Musk’s legal troubles

On October 4th, though, Musk taunted the SEC on Twitter, referring to it as the “Shortseller Enrichment Commission.” Later that day, Judge Nathan asked that the SEC and Musk submit a joint letter justifying the settlement in order to ensure that it was “fair and reasonable.” The letter was submitted on October 11th, and Judge Nathan approved it today.

The approval isn’t the end of Tesla and Musk’s legal troubles, though. The SEC is also currently investigating whether Musk misled shareholders with his repeatedly shifting promises for Model 3 production rates. The Department of Justice has also opened a criminal investigation into Musk’s privatization attempt. And a number of shareholders have sued Musk over the “funding secured” debacle.