Volkswagen AG CEO Martin Winterkorn announced today he is stepping down as the result of his company's cheating on emission tests, bypassing environmental standards and landing the company in regulatory hot water.

According to the U.S. Environmental Protection Agency, Volkswagen was able to cheat emissions tests for half a million of its U.S.-sold cars. The software that enabled cars to thwart emissions tests is in as many as 11 million other vehicles, Volkswagen admitted Tuesday.

Diesel cars from Volkswagen and Audi cheated on clean air rules by including software, likely a single line of code that made the vehicles' emissions look cleaner than they actually were.

The EPA described the software Volkswagen used as a "defeat device."

"This results in cars that meet emissions standards in the laboratory or testing station, but during normal operation, emit nitrogen oxides, or NOx, at up to 40 times the standard," the EPA said in a statement.

So how was Volkswagen's exhaust system able to deceive emissions testing?

Arvind Thiruvengadam, a research assistant professor at West Virginia University, was involved in a project last year that evaluated tailpipe emissions of diesel cars made by European manufacturers for the American market.

In an interview with Autoblog, Thiruvengadam told how his group drove a Volkswagen Jetta, a Passat and a BMW X5 for thousands of miles along California's highways to get their emissions results.

While the Passat should have been among the lowest in emissions of the three cars, tests showed 20 times the baseline level of emissions the team had established for the cars.

The research team reported its findings to the California Air Resources Board, which then further investigated. That ultimately led to the charges by the EPA.

Thiruvengadam said he hasn't researched the software that allowed Volkswagen to cheat on the tests. But he did say "there were lots of ways an electronic control unit could be programmed to identify testing and change its fuel mapping toward low emission in those rare scenarios."

For example, modern cars can sense when a hood is open for dynamometer testing, "so a smart hood switch could double as a defeat device."

Or, another sensor could detect when a vehicle's traction control unit was disabled, which is required during emissions testing, and place the emission system into a different mode.

"The possibilities are almost endless," he told Autoblog. "I'm pretty sure that if you're one of the largest car manufacturers, you could do a lot more."

According to the EPA's violation letter to Volkswagen, dated Sept. 18, "the position of the steering wheel, vehicle speed, the duration of the engine’s operation, and barometric pressure" -- all very specific indicators of an emissions test -- acted as the activation switch for the "deafeat device".

Essentially, the vehicles' electronic control module (ECM) was set to "clean" mode for the remainder of the emission's test procedure.

"The 'switch' was activated and the vehicle ECM software ran a separate 'road calibration' which reduced the effectiveness of the emission control system (specifically the selective catalytic reduciton or the lean NOx trap," the EPA stated.

So who authorized the algorithm?

Nikhil Kaul, a product manager at test/dev software maker SmartBear Software, said the code that enabled Volkswagen and Audi vehicles to detect when cars were being tested was likely extremely simple.

"With one line of code you can break down how it happened," Kaul said. He described an "'if' statement with two clauses: If you do this, then do that. If something doesn't happen, do this."

Volkswagen has said it will set aside $7.27 billion in anticipation of legal costs to deal with scandal.

But who was responsible for the software being installed in 11 million vehicles?

Winterkorn said in a statement he was "shocked by the events of the past few days" and stepped down "in the interests of the company, even though I am not aware of any wrongdoing on my part."

Kaul said finding out who knew what and when at Volkswagen could be a simple task: Just follow the development and testing audit trail.

However, not all companies follow detailed auditing processes. The primary reason, Kaul said, is the speed at which software is being released to the marketplace. It necessitates an "agile approach," resulting in millions of lines of code being worked on and checked into production every minute.

"And, right now, everyone is saying, we did not do it," Kaul said in an interview with Computerworld.

But even if software development steps aren't being audited, testing of that software is. And, if the software didn't work as it was supposed to, someone either didn't test it, or they didn't reveal the test results.

"In this case, they're saying the exhaust system was using the software. Someone developed the software for that. You can see who wrote the code for that software. You can actually see who asked the developer to write that code," Kaul said in a blog.

"Then if you go upstream you can see who that person's boss was...and see if testing happened...and, if testing didn't happen," Kaul said. "So you can go from the bottom up to nail everyone."