The fact that Barack Obama woke up today marks a major historical milestone—yet it’s likely to go largely unnoticed. It’s now been 18,967 days since a US president died in office. That means the nation has now entered its longest period without losing a president to an assassin or illness.

This record reflects dramatic advances in medical science and the increasing sophistication of presidential security—the occasional White House fence-jumper notwithstanding. The previous record was 18,966 days, running from George Washington’s inauguration on April 30, 1789 to William Henry Harrison’s death by pneumonia on April 4, 1841.

“People today don’t have an appreciation for what a calamity it is to lose a president,” says journalist Ronald Kessler, author of In the President’s Secret Service: Behind the Scenes With Agents in the Line of Fire and the Presidents They Protect. “Most Americans tend to think of assassination or death as being such a remote possibility.”

“People today don’t have an appreciation for what a calamity it is to lose a president.”

Yet there was a time in which presidential death was unfathomably common. When John F. Kennedy was gunned down in Dallas on Nov. 22, 1963, he became the eighth US president to die in office in the span of 122 years. That included three assassinations—those of Abraham Lincoln, James Garfield and William McKinley—within a 36-year span, between 1865 and 1901.

“The frequency of presidential deaths even gave rise to a superstition known as Tecumseh’s Curse.”

The frequency of presidential deaths even gave rise to a superstition known as Tecumseh’s Curse. Legend has it that Harrison, at the time the governor of the Indiana Territory, triggered the curse when he put down a Native American resistance to US westward expansion in 1811. Tecumseh, a leader of the Shawnee tribe, was rumored to have taken revenge on Harrison by dooming the nation to lose every future president elected in a year ending in zero. Harrison, elected in 1840, succumbed to complications from pneumonia just 32 days into his term and may be best remembered for refusing to wear a coat at his inauguration. The streak held all the way to either Ronald Reagan, who was elected in 1980 and survived John Hinckley’s assassination attempt, or George W. Bush, elected in 2000, depending on who you ask.

So what’s contributed to US presidents’ newfound longevity? One major factor is that our recent presidents have been younger and healthier, according to Jeffrey Engel, director of the Center for Presidential History at Southern Methodist University.

“Carter, [George W.] Bush, Clinton and Obama really bring down the numerical average of the age of presidents,” he says. “The actuaries tell us they’re less likely to die.”

It was only in 1991 that the president started having a medically trained professional on call nearby at all times.

Medical advances have also played a big part. Reagan almost certainly wouldn’t have survived if he had been shot in the gut even 30 years earlier, according to Brooks Simpson, a presidential historian at Arizona State University. But improvements in surgery and wound care changed his prognosis.

Under the care of today’s doctors, Garfield and McKinley might have survived their assassination attempts. Garfield lived 11 weeks before succumbing to infections from gunshot wounds and McKinley lasted eight days.

Similarly, Harrison would be far less likely to succumb to pneumonia today. Modern-day medicine could have also helped Zachary Taylor (stomach ailment) and Warren G. Harding (heart attack). On the other hand, Franklin D. Roosevelt, who died of a cerebral hemorrhage in 1945, had many ongoing health problems and may well have died anyway.

Medical care has also become more immediately available to presidents in recent decades. It was only in 1991 that the president started having a medically trained professional on call nearby at all times, with the appointment of Dr. Connie Mariano as president George H.W. Bush’s doctor. Before that, the Secret Service was responsible for rushing the president to George Washington Hospital if an emergency happened overnight. Now the president is never far from a team that can perform triage if necessary, along with a supply of compatible blood.

It’s not always easy to get presidents to cooperate with medical advice.

Mariano, who stayed on as Bill Clinton’s doctor and left the White House in early 2001, says on-call care is extended to first ladies and vice presidents, too. This is likely why Dick Cheney survived his heart attacks. “His life was extended because he was in high levels of government and had access to round-the-clock medical attention,” she says.

It’s not always easy to get presidents to cooperate with medical advice, especially when appearing healthy and vibrant is so important to their public image. Mariano begged Clinton to cancel or postpone a 1997 summit in Helsinki with Russian president Boris Yeltsin after he tore a knee tendon and required surgery. Eventually they struck a compromise: Clinton agreed to use a wheelchair to reduce the risk of a post-surgery blood clot.

Mariano, author of the memoir The White House Doctor, also believes the process of becoming president—delivering countless speeches, constant standing and walking, and endless hand-shaking—helps vet the nation’s leaders for physical strength. If they have that kind of stamina and their immune systems are that efficient, they may have stronger constitutions, she says.

Presidents are constantly rubbing their hands with Purell out of camera’s view.

There’s also a tremendous focus on preventative measures for presidents. Presidents are constantly rubbing their hands with Purell out of camera’s view, Mariano says, and doctors stay alert to potentially contagious illnesses among senior staff and in the cities they visit. One time, she recalls, she had Clinton take a prophylactic three-day course of antibiotics because he visited a city in the throes of a meningitis outbreak.

Advances in security have also improved US presidents’ chances of survival. No president since Reagan has faced an active shooting attempt—at least to public knowledge.

However, several high-profile security lapses during Obama’s tenure have led to sharp criticisms of the Secret Service. A pair of reality stars crashed a state dinner for the prime minister of India in 2009. The aforementioned fence-jumper actually made it inside the White House. And an armed private security guard somehow rode an elevator with Obama in Atlanta in 2014.

Obama has been the target of about 10 times the number of death threats as his predecessors without major incident.

Still, as serious as these errors are, modern-day security simply does not permit the president to, say, ride in an open-air limousine. Nor does the public have the sort of access to the White House that was once so permissive that John Adams had to personally talk down a threatening man who’d entered his office.

“I’ve been very, very upset about the general tenor of the political discussion about the Secret Service snafus,” says Engel of Southern Methodist University. “The most important thing that needs to be stressed is that the Secret Service faces a fundamental problem much like the nation’s intelligence agencies, which is that failures are obvious and successes, though a dramatic order of magnitude, are invisible.”

Engel notes that Obama in particular has been the target of about 10 times the number of death threats as his predecessors without major incident. Also, like prior presidents, Obama comes into physical contact with countless people, none of whom have been able to do harm.

“For every instance of an individual penetrating the White House, remember that president Obama has probably shaken hands with 100,000 people this year alone,” Engel says. “That’s a lot of people up close—and no incidents.”

There’s reason to fear that the nation will face another presidential calamity one day. The average age of four of the leading candidates for president in 2016—Donald Trump, Hillary Clinton, Bernie Sanders and Ben Carson—is 69 years old. And the threat of international terrorism, as well as the vicious, angry tenor of contemporary politics, could give rise to would-be assassins. A security mistake or medical mishap could easily result in future tragedy.

“I hope and pray that we don’t have a presidential death,” Mariano says. “But no medical system is 100%. That’s why we have the vice president who is, as they say, one heartbeat away. Our jobs are to make sure that heart keeps on beating.”