If democracy means the majority rules, the Electoral College is an undemocratic institution. Twice in the last five elections it has delivered the White House to the loser of the popular vote. In 2000 it gave the nation George W. Bush. Two weeks ago it gave us Donald Trump, although Clinton will most likely have a more than two million vote edge among those who cast ballots. Many people, not just liberals, fear that a Donald Trump presidency will threaten core American values. Some of his initial appointments and failure to strongly condemn the racism of some of his followers have done nothing to quiet these fears. If this is not enough to condemn the Electoral College to oblivion, it has long since ceased fulfilling the function for which it was intended: namely, ensuring that the President owed his office to the people and not to the Congress (at the time, allowing the Congress to choose the president was the most likely alternative) while at the same time interposing a deliberative group of wise men (and they were all men back in the day) between a perhaps overzealous populace and the country’s most powerful office.

Alexander Hamilton laid out these rationales in Federalist 68:

“It was desirable that the sense of the people should operate in the choice of the person to whom so important a trust was to be confided. This end will be answered by committing the right of making it, not to any preestablished body, but to men chosen by the people for the special purpose… It was equally desirable, that the immediate election should be made by men most capable of analyzing the qualities adapted to the station, and acting under circumstances favorable to deliberation, and to a judicious combination of all the reasons and inducements which were proper to govern their choice. A small number of persons, selected by their fellow-citizens from the general mass, will be most likely to possess the information and discernment requisite to such complicated investigations. It was also peculiarly desirable to afford as little opportunity as possible to tumult and disorder…. The choice of SEVERAL, to form an intermediate body of electors, will be much less apt to convulse the community with any extraordinary or violent movements, than the choice of ONE who was himself to be the final object of the public wishes.”

Voters today, however, choose the ONE with all the passion Hamilton feared. Almost no one today can identify the electors whom they are in fact voting for, and the electors do not deliberate nor need they possess special information. It is no wonder that for decades there have been cries to abolish the Electoral College and allow the popular majority to directly determine the nation’s leader.

Yet the undemocratic aspects of the Electoral College do not by themselves make the case for its elimination. Built into our system of checks and balances are several undemocratic institutions, most notably our entire judiciary. Also several procedures, including amending the Constitution and overriding presidential vetoes require supermajorities. The nation seems to have survived these limitations on majoritarian democracy reasonably well, enduring, perhaps in part, because of them. So even for committed small “d” democrats the question must be: does the Electoral College system have any virtues that offset its occasional frustration of the majority’s will?

At least two such virtues exist. The first we saw at work in the year 2000 election. Whoever won, Bush or Gore, it was going to be by a hairsbreadth. Because of the Electoral College, we did not have to recount the whole nation. Instead we could focus on a more manageable task—recounting the state of Florida. Imagine the problems that would arise, tensions that would exist, and the claims of illegitimacy likely to follow if the entire nation had to be counted, and then recounted to ascertain the results of the election. Even today, several weeks after the election, some states are still counting ballots. But for the Electoral College, we would seldom if ever know the winner of the election on Election Day, and we might routinely be in the dark until weeks after the election. Also, if an election was close enough to justify a recount, how would we manage it? The Florida 2000 recount seems to have employed a substantial fraction of the lawyers most versed in election law. Where would we find the trained lawyers, poll watchers and others needed to oversee a fair nationwide recount, and what would judicial supervision of a 50 state recount look like? The Electoral College saves us from having to deal with such challenges.

The other great service that the Electoral College provides is to remove incentives to rig elections. Imagine that you are a partisan, passionate, and not completely ethical election official in, say, Maryland or Mississippi. In neither state do you have reason to tamper with the electoral process because it is the state-wide winner and not the winner’s majority that matters. In Maryland the Republican candidate will have no chance to win while the opposite is true in Mississippi. If, however, the national popular vote winner became President, the most passionate partisans would have reason to stuff the ballot boxes for their favored candidate while illegally misreporting or suppressing votes they do not want to count. Moreover, local election management could mean that in some areas the task might not be that difficult because one party might have a stranglehold on voting procedures and vote counting. Even if a split between the Electoral College and popular majorities leaves many feeling an election outcome is not fully legitimate, threats to the perceived legitimacy of election outcomes, and claims of illegitimacy might, in close elections, be far greater if the Electoral College did not exist.

Personally, I would have liked to have seen the popular vote determine this past election, and I expect the Electoral College’s undemocratic element will typically hurt the candidate I favor. Nevertheless, I doubt the wisdom of abolishing the Electoral College. There are, however, changes that should be made to limit the inroads the Electoral College can make on majority rule. First, so-called faithless electors should be barred. Whatever the situation in 1789, voters today expect the wishes of the state’s majority to be followed. In the recent election, however, at least two Democratic electors hinted that they might not cast their ballots for Clinton if she was their state’s winner, while groups on the left have circulated petitions asking Republican electors to abandon Trump. In a close election defectors could reverse not just the popular majority but the apparent Electoral College majority as well. Moreover, the discretion accorded electors is such that even if their votes were later shown to have been motivated by threats or bribes it is hard to see a constitutional basis for overturning their actions. The solution here is a simple one. While the Electoral College should be maintained, human electors need not be. The Constitution could be amended so that each state’s winner automatically received that state’s electoral votes.

Second, perhaps after grandfathering the divergent practice in Maine and Nebraska, electors in all states should be required to vote unanimously for the state’s winner. Maine and Nebraska, which allocate a portion of their electoral votes by congressional district, have so few electors that their divergence from common practice is unlikely to matter. The same is not true in other states, like Pennsylvania where the idea of allocating electoral votes by congressional district was floated when Obama ran for his second term. The possibility was real because Republicans controlled the governorship and both houses in the state legislature. It was attractive because although Pennsylvania appeared likely to tip toward Obama, Romney was sure to lead in some congressional districts. Not only is allocating electoral votes this way too great an interference with the will of the majority to be tolerated in a democracy, but also the threat is seriously exacerbated by the partisan nature of redistricting. Yet even the elimination of partisan gerrymandering would not solve the problem, for the natural concentration of democratic voters in urban areas would unduly skew the Electoral College in a Republican direction. We see in the recent election that the Presidential preferences of voters in some states, California being the best example, count less than the preferences of voters residing elsewhere. Baker v. Carr, the case that upended the rural domination of state legislatures, and put teeth into the one person/one vote principle should be interpreted to prevent partisan tinkering with established rules for electoral vote allocation, though the safer path is a constitutional amendment.

It is understandable that many Democrats today would have the nation abandon the Electoral College system and elect its president by popular majority. Even if Republican politicians would never let this happen, the idea has natural attractions for voters across the political spectrum. We should, however, recognize that even if the Electoral College is an anachronism that has long since ceased to perform as the framers expected, it fills other functions today. These functions are arguably so important that the path of wisdom is to mend the Electoral College not end it.