DETROIT (AP) — After months of wrangling with the U.S. government, Volkswagen has agreed to buy back or fix about 482,000 vehicles with 2-liter diesel engines that are rigged to cheat on emissions tests.

Details of the decision announced Thursday in a federal court hearing are still being worked out. Also yet to be decided are what Volkswagen will do with another 90,000 VW, Porsche and Audi brand vehicles with 3-liter diesel engines.

And the government and Volkswagen are still working out fines and penalties for the automaker, as well as ways to fix the environmental damage caused by the cars, which can spew out 40 times the allowable limit for harmful nitrogen oxide.

Volkswagen announced Friday it will take $18.2 billion writedown for 2015 as a result of the scandal,  which stems from its admission it installed software on 11 million cars globally that turns on pollution controls during government tests and shuts them off on the road.

Volkswagen also announced Friday the release of the results of its investigation into the scandal has been delayed.