In 2018, Tesla turned its biggest ever quarterly profit, and its first profit in two years. The company shipped close to some 100,000 Model 3s in the first full year of production of the most affordable vehicle it makes. SpaceX, one of Tesla CEO Elon Musk’s other companies, successfully launched its brand new Falcon Heavy rocket for the first time ever — and Musk used it to send one of the original Tesla Roadsters into space. By those measures, 2018 was a wild success for Tesla.

Of course, there’s more to the story: a failed plan to go private, announced by Musk on Twitter; a beef with the SEC; difficulty retaining top executives not named Elon Musk; and a close call with death. There were questions about the safety of Tesla’s cars, the safety of the workers making the cars, and the customer service buyers received. What could be viewed as a rebound year for Tesla was in reality more like a roller coaster ride, something reflected in the stock price, which started this year at $323, touched as high as $387 and as low as $244 before settling at $334 at the end of trading on December 28th — a slight improvement.

But Musk “bet the company” on the Model 3, and 2018 was all about watching to see if that gamble paid off. That meant those roller coaster moments were often excruciating for Tesla supporters (and catnip for critics), especially because the company was mere weeks away from death at one point, according to Musk himself.

The year didn’t begin well: Tesla had lost $2 billion in 2017 as it got Model 3 production off the ground, and yet the company was months behind its goals for that car. Only 1,550 Model 3s had been delivered by January 1, 2018 – a far cry from the 5,000 per week rate Musk originally promised for the end of 2017.

Musk also promised that once the ball was rolling on Model 3, production would increase exponentially. That climb began early in 2018, but it wasn’t until Musk admitted Tesla’s push to heavily automate the production line was a mistake that the Model 3 really took off. Musk scaled back to a mix of automation and manual labor in April.

While Model 3 output was still sputtering in March, a Tesla owner in California died in a crash while using the company’s Autopilot driver assistance feature.

The Autopilot death added pressure to the Model 3 production ramp

Tesla said the driver received multiple warnings in the minutes leading up to the crash, insinuating he hadn’t been paying attention — even though it was reported in May that the company had decided against adding more advanced driver monitoring features to its cars. The death brought renewed scrutiny to the company’s effort to increase the autonomy of its cars, and was also immediately followed by the news of Tesla’s largest recall ever for an unrelated steering issue.

(Months after that death, Tesla released its first ever report on the “safety” of its driver assistance feature. Musk promised that Tesla would regularly release these reports, but this first one was short on details. The company also stopped promoting the promised “full self driving” capabilities of its cars later in the year.)

Soon after, in April, Tesla was making 2,000 Model 3s per week. Even at that pace, the company was behind Musk’s already-delayed deadlines. Musk announced Tesla would have to build the electric sedan around the clock to meet its mid-year production goal of 5,000 per week. The stress showed: during a spring investor call, Musk railed analysts for asking “boring, boneheaded” questions and instead spent 20 minutes answering ones from a YouTuber.

Investors seemed to lose confidence, as Tesla’s stock price dropped to its low for the year. The Autopilot death added to the pressure of the Model 3 production ramp, all as the company was “bleeding money like crazy,” as Musk admitted to Axios in November.

In response, Tesla and Musk got more aggressive. Tesla was removed from the National Highway Traffic Safety Administration’s investigation into the Autopilot death from March, though the company says it stepped down on its own. Reveal and The Center for Investigative Reporting also published an expose about alleged workplace safety problems at Tesla’s factory in Fremont, California in April (and followed with a similar story later in the year about the injury reporting practices of Tesla’s on-site health clinic). Tesla responded the story by calling Reveal an “extremist organization.”

In the summer, Tesla steered into the skid: the company built a tent in the parking lot outside the Fremont factory, which allowed Tesla to increase capacity for the Model 3 without radically restructuring how things worked inside the factory walls. After Musk found what he described as a “Russian nesting doll” structure of contractors, Tesla laid off a few thousand workers and flattened the company’s management structure. Tesla also closed a dozen solar installation centers and backed away from a deal to sell its energy storage products at Home Depot as it focused resources on the Model 3.

The on-the-fly adjustments worked. The company hit its mid-year goal just a few hours after Musk’s deadline, and finally started turning a slight profit on the Model 3. Tesla also announced plans for its first international Gigafactory, set to open in China sometime in 2020. It will give the company a chance to tackle the largest market for electric cars in the world without having to ship vehicles across the planet, or deal with touchy trade relations between the US and China. In a flip of the spring investor call, Musk sounded relieved while talking to analysts after announcing the company’s second-quarter results in August.

Then, one week later, the Tesla CEO sent the infamous “funding secured” tweet. Musk announced he wanted to take Tesla private again — at a share price of $420, no less. Tesla hit its stock market high for the year as supporters piled on, hoping to help bring Musk’s tweeted vision to life.

“Funding secured”

A surreal few weeks followed. Musk admitted he had been talking about the plan with Saudi Arabia’s sovereign wealth fund, but then backed away from the idea and kept the company public. But Musk had only held cursory conversations with the people in charge of the fund, and many people inside Tesla — from the company’s head of investor relations, to its chief financial officer — had not been given any heads up about the announcement. All of this emerged later in a lawsuit filed by the SEC. In fact, the lawsuit itself suggested some degree of instability; Musk had been close to settling with the agency and abruptly withdrew, only to enter into a more punitive settlement days later. He was forced to step down as chairman of Tesla for three years, pay a $20 million fine, and submit his public communications about the company — including his tweets — to oversight.

This might explain why so many top Tesla executives ankled the company, including the head of global finance and the company’s accounting lead. That wasn’t all: the SEC, the DOJ and the FBI opened investigations into Tesla. Besides the “funding secured” investigation, the feds were also looking into Tesla’s communications about its Model 3 numbers. The company’s stock languished through early October, nearly matching its low point from the spring, as investors reacted to the settlement and news of the government’s increased focus on Tesla.

The Model 3, meanwhile, swapped “production hell” for “delivery hell.” Tesla leaned on loyal fans and customers to help with a late-year delivery crunch as thousands of Model 3s went out to eager owners around the country. Problems cropped up for these new owners, too, in the form of delivery delays and notable quality issues. Musk admitted Tesla had committed a “foolish oversight” by leaving major gaps in service coverage throughout the US, and promised to improve its reach by early 2019.

Despite the delays, the long hours, and the overextension of the company’s CEO, Tesla made and delivered enough Model 3s to contribute to a $311 million profit in the third quarter of the year. Musk had promised investors earlier in 2018 that Tesla would reach profitability in the second half of the year, and so this was the first big step. (Fourth quarter earnings won’t be revealed until early 2019.) Even this victory for Tesla came with a qualification, though: some $190 million of the $311 million Tesla earned in the quarter came from the sale of regulatory credits.

Still, Tesla’s stock climbed in the following weeks and nearly matched its high in mid-December, though it slid dramatically during a late-month sell-off in the broader market. Tesla’s stock will now leave 2018 more or less where it started.

Tesla leaves 2018 in better shape than it entered

Tesla the company, however, leaves 2018 in better shape than it entered. There are worthy questions to be asked about Autopilot, especially as the United States government wrestles with how to legislate advanced driver assistance systems and, eventually, autonomous cars. The company’s treatment of its workforce is still constantly being scrutinized, and will demand greater attention as Tesla pushes into new regions like China in 2019.

Tesla still has to make good on its original promise to deliver a version of the car that starts at $35,000, which Musk delayed until 2019 in order to focus on more expensive, higher-margin trims. But the Model 3 is now an almost fully realized product, and the company has put itself in a position to be profitable going forward. That couldn’t had happened at a more important time: Musk told Axios in late November that Tesla narrowly avoided death by a matter of weeks over the summer. He bet the company and won. Wherever the story of Tesla goes next, and whatever detours Elon Musk has in store, 2018 will likely be remembered for that.

Final Grade: B-