Automakers have spent billions developing diesel engines to help meet tougher carbon dioxide (CO2) emission standards, so understandably they aren’t willing to walk away from the technology just yet.

But diesels are very much on the nose in the wake of the Volkswagen Group scandal, with some cities, including Stuttgart, home to Mercedes-Benz and Porsche, taking steps to ban diesel cars because of the harmful effects of their emissions, particularly nitrogen oxides (NOx), on health and the environment.

The German government is under extra pressure to take action after the BMW Group and Mercedes parent Daimler were recently accused of selling diesel cars whose emissions exceeded required limits, as well as colluding together with the VW Group on diesel technology for decades. The pressure to take action has also been intensified by the British and French governments recently pledging to end sales of vehicles powered solely by gasoline and diesel engines by 2040.

Germany’s transport authority, the KBA, held an emergency meeting with the BMW Group, Daimler and the VW Group on Wednesday where the automakers agreed to upgrade around five million cars in Germany with software aimed at curbing emissions, even for some older models that meet regulations. PSA Group’s Opel brand will also implement similar software upgrades. The automakers also agreed to participate in a fund to promote sustainable transport in cities.

According to Bloomberg, the software upgrades should reduce NOx emissions by between 25 and 30 percent on average. Crucially, they aren’t expected to have any detrimental effect on fuel economy or performance. The automakers will also offer trade-in bonuses in select markets for owners of older diesel cars that can’t be upgraded. The BMW Group has already announced a Europe-wide 2,000 euro (approximately $2,370) trade-in bonus for older BMW and Mini diesels (those on Euro 4 emission standards) when upgrading to a new BMW or Mini Euro 6 emission standards-compliant vehicle or an electrified model.

No everyone is happy with the agreement, including German Environment Minister Barbara Hendricks who, according to Bloomberg, remains convinced that more costly hardware upgrades are required to existing diesels to reduce pollution levels in German cities. Others are also dissatisfied with the length of time it’s taken the German government to act. Recall, it’s now been almost two years since the VW Group scandal surfaced.