Donald Trump is busy building his Cabinet and planning his agenda, but he isn’t really, officially going to be President quite yet. One of the peculiarities of American democracy is that it’s a group of 538 “electors” – members of the Electoral College – in this nation of 318 million who actually pick the president.

They’ll do it, meeting in their respective states, on December 19. The outcome is a foregone conclusion, but there is room, however small, for a surprise: an uprising, as called for by some Democrats and even some Republicans, of “faithless electors.”

None of the electors are constitutionally bound to follow the will of the people they represent, and so in this bizarre election (and post-election) season, an arcane system that was established at the Constitutional Convention of 1787 could – and this is very unlikely, but could legally – go rogue and potentially deny Trump the presidency.

Scenario 1: The system works and Trump wins

More than 136 million Americans cast a ballot for President on Election Day in November. While Clinton outpaced Trump by nearly three million votes, the Republican’s narrow victories in a series of battleground states secured him a clear victory in the Electoral College.

Based on the November 8 vote, Trump is projected to have 306 votes in the Electoral College – he’ll need at least 270 of them to formally choose him during the December 19 meetings. Those results will be counted and certified by a Joint Session of Congress on January 6. Any other result would throw the republic into a kind of chaos unseen in at least 140 years.

In 48 states and the District of Columbia, all electoral votes are awarded to the candidate who wins a plurality of the popular vote in that state. This is known as a “winner-take-all” system.

Two states – Maine and Nebraska – operate under a “district system,” which awards electoral votes to candidates according to both the statewide vote and the vote in each congressional district. For the first time ever, Maine is splitting its electoral votes. Clinton will get 3 and Trump will snag 1 because of his victory in the 2nd Congressional District.

Scenario 2: ‘Faithless Electors’ go rogue and swing the election to Clinton

If everyone votes as intended, then Clinton will receive 232 electoral votes – 38 shy of the 270 majority she needed to be elected President. So her fate is all but sealed. The scenario that could reverse it would require an extraordinary revolt by dozens of electors, with at least those 38 from states Trump won leaving him to back Clinton and bring her to 270.

Why is this so unlikely? First, consider the makeup of the Electoral College.

The two most common ways electors are chosen – a state-level process – is at a state party convention or by a state party committee. That means electors are often party loyalists and activists – and so would not be leaving just Trump, but defying their GOP friends and colleagues.

Scenario 3: Trump electors defect, but neither candidate receives 270 votes

Before we dig in to how it could go down, here are a few more reasons it will not.

Though there is nothing in the Constitution or federal law that prevents “faithless electors” from voting for a candidate who did not receive a plurality of the popular vote in their state, 29 states do have laws to discourage potential rogues. Among the punishments are potential fines or the threat of being replaced with another elector.

But these laws have rarely been tested, and there is little the state can do to prevent a defection by an elector who is willing to accept the penalty.

So what happens if the “faithless” scuttle the results and effectively deny both Trump and Clinton a clinching 270 votes?

Here’s a step-by-step guide through the mayhem that could follow:

So if the deadlock holds and the House can’t vote on a winner – even more unlikely considering 33 state delegations are controlled by the GOP! – then the new Vice President, as selected in the Senate (with a potential deciding vote from a familiar face), would become the acting President. Here are a few more unlikely steps that could turn the election results on their head:

Here’s a look at all the possible scenarios in one flowchart:

CORRECTION: This story has been updated to accurately reflect when Congress counts and certifies the Electoral College vote. It’s on January 6.