Related

The difference between a vote cast and a vote counted was nowhere clearer than in the Virginia race for attorney general. A week after Election Day, Democrat state Senator Mark Herring proved victorious over Republican state Senator Mark Obenshain by a margin of 164 votes out of over 2.2 million cast, according to the Virginia State Board of Elections unofficial online tally. Localities had until 11:59 p.m. Tuesday to report numbers to the state.

The outcome followed a series of rapid lead changes: there were at least three swings in the first 24 hours after polls closed. As Election Day ended, state Republican Party Chairman Pat Mullins released a statement toasting Obenshain. “Let me be the first to congratulate . . .” he began. A few hours later, Herring announced he “looked forward” to working on behalf of Virginia after taking a “several hundred vote lead.” Five days later, as the provisional ballots continued to be counted, Obenshain woke up with a 17-vote edge, only to go to sleep down by 117 votes. “The margin was close,” Herring wrote in an understated public statement Tuesday night, “but it is clear that Virginians have chosen me to serve as the next Attorney General.”

Virginia, a battleground state for everyone not named E.W. Jackson, would likely have provided a close contest between most two major party candidates. But the weeklong, Pong-like tallies contained other elements exacerbated by the slim margins, most notably faulty counting.

Episodes occurred in Fairfax and Richmond counties, two of the most populous in the state. Among other election observers, Michael McDonald, an Associate Professor of government and politics at George Mason University, found that absentee turnout from Fairfax didn’t match his prediction. While Brian W. Schoeneman, a Republican member of the Fairfax Electoral Board, protested through Twitter that all had been counted, upon further review, state election officials found that a tabulation machine had broken and the votes on a replacement machine weren’t counted. Around 3,000 votes were then reviewed, and a large majority went to Herring, who at that point was losing in the unofficial tally. “I don’t know if they would have caught it,” said McDonald, who joked that Schoeneman “is going to regret for all of his life” that “infamous tweet.”

In Richmond, state officials failed to enter more than 200 votes, throwing the aforementioned 17-vote lead for Obenshain to the razor-slim 117-vote margin for Herring. In this case, officials realized their mistake well before it hit social media.

These errors have an easier chance of being reported and caught by outside observers in Virginia, due to the state’s “unusually transparent” electoral process, according to McDonald, because the state releases not only overall numbers, but also breakdowns in how a vote is cast (including absentee) and in what precinct. That openness, combined with the high level of interest due to the closeness of the campaign, can lead to a messy, but effective evaluation.

“These are common errors for certification across the entire country,” says McDonald. “Usually you don’t get to see into the factory where the sausage is being made.”

Charles Judd, chairman of the Virginia State Board of Elections, praised the localities for doing a “very good job” while admitting “it’s a little unusual—the number of human errors that can occur with data entry.” Judd says that the election “appears to be the closest that anyone can remember.” In 2003, Gov. Bob McDonnell won the attorney general’s race over Democrat Creigh Deeds by 360 votes.

Judd told TIME that 80 to 85 percent of Virginia’s precincts use electronic touch screens and the rest paper scanners. Judd would prefer to replace the current system with one that would take a digital picture of the paper-scanned ballot, which would be helpful during recounts. He says it “could eliminate that step where a lot of human error occurs” as the digital picture could be exported to the database automatically.

Judd also has some choice words for the touch screens, which he says are 18 years old and aren’t made anymore. “We’re limping along with equipment that’s old and failing us some,” says Judd. “An upgrade is necessary.”

“That doesn’t have anything to do with how the results are tabulated, it’s just that it’s a maintenance challenge,” he added.

While one part of the election is over, the official re-canvassing effort won’t be finished until November 25. Virginia election law also allows Obenshain to request a recount since the margin is less than one percent, and the state will pay for it since the margin is less than one half of a percent. (The current margin, according to the Virginia State Board of Elections is .01%.) Obenshain did not concede Tuesday.

“We owe it to the people of Virginia to make sure we get it right, and that every legitimate vote is counted and subject to uniform rules,” wrote Obenshain in a public statement. “We have seen significant swings in the vote count over the last several days as errors are corrected as a part of the regular canvass process.”

McDonald says that a recount would verify electronic votes on memory cards and evaluate paper ballots to see if a voter made an error that would be devastating for their SAT score: circling, rather than filling in, the bubble.

The position of Virginia attorney general is usually a stepping-stone for a campaign for governor: McDonnell, as mentioned, was a former state attorney general, and Democratic Senators Tim Kaine and Mark Warner defeated attorneys general on their way to the Executive Mansion. Last week, current Virginia attorney general Ken Cuccinelli lost to Democrat Terry McAuliffe.

Herring’s win marks the first time in over forty years that the Democrats swept all five statewide offices: both Senate seats, Virginia governor, lieutenant governor, and attorney general.