Elon Musk has reached a settlement with the Securities and Exchange Commission on the charges filed earlier this week over his abandoned attempt to take Tesla private. Musk will have to step down as the chairman of Tesla within 45 days, and will not be able to take that role with the company again for three years. He will be able to remain Tesla’s CEO during that time.

Alongside the settlement, the SEC also charged Tesla with “failing to have required disclosure controls and procedures relating to Musk’s tweets,” according to the agency. Tesla has already agreed to settle this charge. Both Musk and the company will pay separate $20 million fines that will “be distributed to harmed investors under a court-approved process,” according to the SEC, and Tesla is being made to appoint two new independent directors to its board. The company will also hire a lawyer to monitor Musk’s communications, including his tweets, according to the agreement.

A lawyer will now oversee Musk’s communications — including his tweets

“The total package of remedies and relief announced today are specifically designed to address the misconduct at issue by strengthening Tesla’s corporate governance and oversight in order to protect investors,” Stephanie Avakian, co-director of the SEC’s enforcement division, said in a statement.

The terms of the settlement closely mirror the deal that numerous outlets reported was on the table Thursday morning, which would have required a two-year chairman ban and a $10 million fine. The two sides were so close to agreeing to those terms, according to the New York Times, that press releases were even being drafted. Musk ultimately decided that he didn’t want to go through with it, though, and later that day the SEC charged him with securities fraud.

In addition to the other terms, Musk had to agree to a condition where he is not allowed to either “admit nor deny” whether he was guilty of committing securities fraud, meaning that he cannot publicly state that he did nothing wrong — something that was reportedly a sticking point that caused Musk to walk away from the original deal.

The SEC opened an investigation into Musk and Tesla in early August, shortly after the CEO abruptly announced on Twitter that he was considering taking the company private at a share price of $420. Musk said that he had the “funding secured” to pull off the feat, and that support from investors was confirmed as well.

While Musk reportedly had held multiple meetings with Saudi Arabia’s sovereign wealth fund about backing the privatization effort, the SEC argued in its lawsuit that Musk did not have a solid deal in place, and therefore his tweets were therefore “false and misleading” to investors.

“Musk knew that he had never discussed a going-private transaction at $420 per share with any potential funding source, had done nothing to investigate whether it would be possible for all current investors to remain with Tesla as a private company via a ‘special purpose fund,’ and had not confirmed support of Tesla’s investors for a potential going- private transaction,” the agency wrote in its complaint.

The first hearing in the SEC’s case against Musk was scheduled for February. The Department of Justice reportedly still has an open investigation into his failed privatization attempt, and a number of shareholders have sued Musk in court for losses resulting from the alleged market manipulation.