For Tesla, the past three months have been filled with incredible milestones and daunting challenges. Since producing 5,000 Model 3 in a week at the end of Q2, the electric car maker has steadily pushed itself out of “production hell” and well into Elon Musk’s self-dubbed “delivery logistics hell.” As the final hours of the third quarter trickle down, Tesla is now on full throttle as it attempts to end Q3 2018 on a historic note.

It has not been easy for Tesla, and particularly its CEO, Elon Musk. It is not difficult to see that Musk’s status as a rockstar CEO has served Tesla well, but at the same time, some of Musk’s personal mistakes have also negatively affected the electric car maker. Earlier this month, for example, Tesla stock took a steep tumble after news of two executive departures were augmented by Musk’s actions during a podcast, which included an instance when he seemingly smoked cannabis.

Perhaps Musk’s most notable gaffe, though, was a post last August stating that he was considering taking Tesla private at $420 per share, and that he had “funding secured.” The Securities and Exchange Commission (SEC) ultimately filed a lawsuit against Musk over his “funding secured” tweet, claiming that the CEO knowingly misled investors. Musk settled with the SEC this weekend, agreeing to pay a total penalty of $40 million, comprised of a $20 million personal fine and another $20 million fine for Tesla. Part of the settlement also included Musk’s resignation as Chairman of Tesla’s Board of Directors, the appointment of two new independent directors, as well as the creation of a new committee tasked to “place additional controls and procedures to oversee Musk’s communications,” particularly on social media platforms such as Twitter.

While it is unfortunate that Elon Musk must relinquish his post as Chairman of Tesla’s Board of Directors, his settlement with the SEC could ultimately be seen as Musk’s decision to take a personal blow instead of compromising Tesla’s progress. Elon Musk, after all, reportedly rejected the SEC’s initial settlement, and by Friday, it seemed like he was preparing to battle it out with the government agency. This was one of the reasons why the SEC’s announcement on Saturday about Elon Musk’s settlement came as a welcome surprise for the Tesla community.

Ultimately, Elon Musk appears to have put Tesla before his own wishes to fight back against the SEC. And it wasn’t like he was cornered by the government agency either. Former SEC senior counsel Thomas Gorman, who is also a partner at the law firm Dorsey & Whitney, stated that the agency miscalculated when it filed a lawsuit against Musk. Gorman noted that while Elon Musk’s “funding secured” tweet last August was not smart from a business perspective, the SEC would have a very difficult time proving that the CEO actually committed fraud. Gorman further noted that the Saudi fund’s reported interest in Tesla’s take-private deal would likely be enough to make Musk’s statements legal.

“There’s a reasonable basis for what he said. I’m not questioning their motive. I just disagree with their judgment here,” Gorman said.

Ultimately, Elon Musk’s SEC settlement has now provided a clear path for Tesla to attain a record-breaking third quarter without any unnecessary drama. Elon Musk himself has noted that Tesla’s main challenge now is delivering as many vehicles to reservation holders as quickly as possible. Tesla, for its part, has begun adapting to the delivery challenges. Handovers reportedly go well into the night, home deliveries are being done to a number of reservation holders, and even owners of Tesla vehicles who are willing to volunteer their time have been tapped to help the company in its end-of-quarter push. Tesla’s production and delivery figures this Q3 would likely set new records, and with Elon Musk’s SEC lawsuit in the rearview mirror, there is very little that can come between the electric car maker and even more impressive milestones.