On Tuesday morning, US District Judge Charles Breyer gave final approval on a $14.7 billion settlement in the Volkswagen Group diesel emissions scandal that broke last September. The German automaker outfitted many of its diesel VWs and Audis with illegal software that reduced the cars’ emissions in the lab but spewed up to 40 times the legal limit of nitrogen oxide (NO x ) on the road.

The automaker said that with the judge’s approval, it would begin buying back affected diesels by mid-November.

According to the terms of the settlement, VW Group has set aside $10.033 billion to buy back 475,474 2.0L diesel TDI vehicles at the value the car was worth in September 2015 before the EPA made public VW Group’s misdeeds. (That number is a bit smaller in practice because about 3,500 customers have opted out of the program thus far according to Reuters, possibly with the hope of suing Volkswagen outside of this consumer class action.) Consumers and lessees will also get an additional payout of between $5,100 and $10,000 depending on the model and year of their car.

The settlement does not include some 80,000 3.0L diesel VWs, Audis, and Porsches that were also equipped with illegal software—lawyers for VW Group, the Department of Justice, the Environmental Protection Agency, the California Air Resources Board (CARB), and consumers are still hashing that out.

When plaintiffs announced the settlement with VW Group in June, they added that customers could also opt to have their diesels fixed so that the cars would conform to US emissions regulations. Those customers would also receive the additional payout and they’d get to keep their cars. Thus far, however, the EPA and CARB haven’t approved any fix that VW Group has offered, although VW Group lawyers contend that negotiations are ongoing.

VW Group can’t resell any of the diesels it buys back from customers until it has an EPA-approved fix, the settlement stipulates.

The deal also has VW Group put up an additional $4.7 billion in federal fines and funding for zero-emissions and alternative energy research. California, which is home to about 71,000 of the affected diesels and whose Air Resources Board played an integral role in discovering VW Group’s deception, will get $1.2 billion of the $4.7 billion. In a statement, CARB wrote, “About $381 million will be spent on projects to reduce smog-producing pollution, such as incentivizing clean heavy-duty vehicles and equipment in disadvantaged communities. Approximately $800 million (ZEV Investment Commitment) will be invested to advance California’s groundbreaking Zero Emission Vehicle (ZEV) programs.

"VW will make these payments and investments in installments over several years, and the two sums together will provide funding to mitigate all past and future environmental harm, including harm to California’s clean vehicle market, that resulted from VW’s cheating," the air regulator said.

In a statement, Elizabeth Cabraser, lead counsel for consumer plaintiffs in the case, said, “We are very pleased the Court has granted final approval to this historic settlement that holds Volkswagen accountable for its illegal behavior and breach of consumer trust. We encourage all class members to take advantage of the significant compensation this settlement provides, which also fixes or removes these polluting cars from our roads. Those who wish to participate in the settlement have until September 1, 2018, to submit their claims.”

VW Group also had reason to celebrate the approval of the deal, as it reduces the uncertainty that the company will face in the future. Hinrich J. Woebcken, president and CEO of Volkswagen Group of America, said that “Volkswagen is committed to ensuring that the program is now carried out as seamlessly as possible for our affected customers and has devoted significant resources and personnel to making their experience a positive one.”

Reuters reports that the company has hired 900 people to implement the buybacks, placing at least one employee dedicated to buying back diesels at each dealership.

It doesn’t mean that VW Group’s legal woes are totally over, of course. Individual states have begun to sue the company for deceptive practices, and the German automaker just this month agreed to pay 652 Volkswagen dealers a total of $1.21 billion for their losses.