Hillary Clinton may have been diagnosed with pneumonia last week, but the illness in not expected to keep her from the campaign trail for long. Clinton’s campaign said on Monday that she would return to the trail this week and that more information would be released showing she is in good health.

But Clinton’s bout of pneumonia reminded voters that the unexpected can be expected in the final months of a presidential campaign. And if candidates do fall seriously ill, or otherwise find themselves unable to serve before the election, there is no clear contingency plan for replacing a presidential nominee.

The question of replacing a candidate also arose in August, when there was speculation that Donald Trump could drop out of the race after receiving the Republican nomination. “It points out the fragility of our election system and the lack of ability to deal with these kinds of issues,” said Rick Hasen, professor at University of California’s Irvine School of Law.

So what would happen? A presidential candidate has never been replaced by a major party after winning the nomination. This late into the presidential race—with just 57 days to go—a party would have to navigate a multitude of different state laws and its own procedures, making it difficult to replace its nominee.

The first step would be for the Democratic or Republican parties to fill the vacancy.

The process for nominating a candidate before the Democratic convention is circuitous and requires participating in state primaries and caucuses from Iowa to California. But if there is a vacancy on the ticket after the candidates have been nominated at the convention, the rules are simple. The Democratic National Committee is responsible for filling vacancies “in the nominations for the office of President and Vice President,” according to the Party’s Rules and Bylaws Article 3, section 1. There are no rules that would prevent the party leadership from holding a meeting and deciding unilaterally on a replacement. (The DNC did not return a request for comment.)

The Democratic Party has done this before. A few months before the 1972 presidential election, Democratic nominee George McGovern discovered that his vice presidential nominee had had multiple bouts of depression and related hospitalization. Fearing McGovern’s running unlucky mate, Thomas Eagleton, would hurt the ticket’s chance in November, The Democratic Party replaced him with a former ambassador, Sargent Shriver.

The Republican Party rules are more particular, requiring party members to vote on a replacement according to the same number of votes the state was allotted at the national convention. A candidate must also receive a majority of party member votes.

If one of the parties replaces its nominee, it would also have to replace its candidate on all fifty state ballots.

With 57 days to go until the election, the Republican and Democratic parties have already submitted the names Clinton-Kaine and Trump-Pence to all fifty states for the top of the ballots. At this point, every state would have to approve the change individually.

In some states, according to the law, it is too late. Many deadlines to submit a name for president and vice presidential nominee have already passed.

In Colorado, for example, nominees’ names must be submitted to the state elected officials sixty days before election day—that would have been September 9th. In Iowa, it’s 81 days before the election—that was August 19. In Ohio, it’s a full 90 days ahead of election day. Still, the parties could challenge various states where the deadline passed and ballots have not yet been printed.

Historically there has been some leeway in the way the limits are applied. The New Jersey nominee for the U.S. Senate in 2002, Sen. Robert Torricelli, was accused of ethics violations and withdrew from the race 36 days before election day—15 days past the statutory deadline. Republicans objected to replacing him with another Democrat, Frank Lautenberg, but the New Jersey courts approved Lautenberg’s name on the ticket.

In 1990 a Minnesota Republican gubernatorial candidate was replaced on his state’s ballot little more than a week before election day. “This would be a gray area and there could be litigation,” said Kay Stimson, director of communications at the National Association of Secretaries of State.

If Clinton or Trump were replaced after some early ballots have already been cast, that could be even more complicated. Voting began in North Carolina on Friday and is set to begin in Virginia in late September. It is unclear whether a replacement would invalidate early votes.

The electoral college system is set up so that in November, after the millions of ballots have been cast, each state’s cohort of electors (29 in New York state, 20 in Pennsylvania, 38 in Texas—all adding up to 538) are counted for the winning party in their state.

But in some states, electors are pledged to a candidate, and in others, to a party. So if Clinton or Trump were replaced in late October, for example, after a long period of early voting, it is up to each state’s law to decide whether the electors are able to vote for the former nominee instead of the new one.

In Michigan, for example, electors must support the nominee on the ballot. But in Colorado, electors are required only to vote for the presidential candidate who received the most votes. In some states, there are no laws at all, and an elector can simply vote for the former nominee.

On Monday, Clinton is skipping a campaign trip to California to stay home and rest, and is calling into a fundraiser by phone instead of attending. Then she is likely to continue on the campaign trail.

On November 8, voters should expect to see Clinton and Trump’s names atop their ballots.

Get our Politics Newsletter. The headlines out of Washington never seem to slow. Subscribe to The D.C. Brief to make sense of what matters most. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Contact us at letters@time.com.