After a slow start to the year, Tesla announced Tuesday that it made and delivered a record number of cars in the second quarter of 2019. The electric automaker produced 87,048 vehicles in the quarter, and delivered “approximately 95,200,” after having finished the first quarter of the year with some 10,000 cars listed as “in transit.”

Of the total cars produced, 72,531 were Model 3s. Tesla also delivered 77,550 Model 3s in the quarter.

Those numbers were above the expectations of industry analysts, many of whom expected closer to 91,000 deliveries this past quarter. Tesla’s previous best quarter came at the end of 2018, amid the company’s mad push to meet its own sky-high goals for the year.

The previous record was set at the end of 2018

News of Tesla’s quarterly performance comes at a time where Tesla lost three high-ranking executives in the span of a week. Peter Hochholdinger, one of the company’s production VPs, was recently hired away by EV startup Lucid Motors. VP of engineering Steve MacManus left Tesla after four years with the company, and VP of Tesla Europe, Jan Oehmicke, also left the company this week. (Executive departures have been a bugaboo for Tesla for a while now.)

Tesla CEO Elon Musk said there was a “good chance” the company was in for a record quarter in May, according to a leaked all-staff email. But just last week, he sent another email to employees pushing them to help the company reach that goal. “There is a lot of speculation regarding our vehicle deliveries this quarter,” Musk wrote. “The reality is that we are on track to set an all-time record, but it will be very close. However, if we go all out, we can definitely do it!”

Tesla posted a $702 million loss in the first quarter of the year thanks, in part, to poor delivery numbers as the company began shipping the Model 3 to Europe and China. Tesla also cut 7 percent of its workforce in January, before announcing a plan to close most of its stores and lay off more workers. (The company eventually partially reversed this decision.)

That all disappointed Wall Street, especially since Tesla had just come off its first back-to-back profitable quarters ever. The company’s stock price dropped by more than $150 per share between January and June. Tesla also recently raised more than $2 billion in new funding, but Musk told employees in May that the company still needed to implement “hardcore” cost-cutting measures in order to turn things around.

Tesla was coming off of a bad quarter where it lost $702 million

But recent optimism around Tesla’s second quarter numbers brought the price back up to the low-to-mid $200 range, and was as high as $240 in after-hours trading Tuesday. Some of that optimism came from the fact that Tesla had supposedly worked out some of the kinks it had run into with the early Model 3 deliveries in Europe and China. The company didn’t break out deliveries to those regions in the numbers released Tuesday, but China is the biggest market for electric vehicles in the world, and Europe is on par with the United States.

Tesla releases production and delivery numbers at the end of every quarter, usually about one month ahead of when it has to report its quarterly financial results. So it will be a few weeks before anyone outside the company knows whether the record quarter brought Tesla close to making a profit again. Tesla and Musk have previously warned investors that they’re not likely to turn a profit again until the third quarter of this year.

The strong quarter should help Tesla get back on track to hit its goal of delivering between 360,000 and 400,000 cars this year. “We believe we are well positioned to continue growing total production and deliveries in Q3,” the company wrote Tuesday. Tesla is also in the middle of building a third Gigafactory in China, where it plans to make and sell Model 3s locally in the country.