Speaking with the New Yorker's David Remnick after Donald Trump's victory, President Obama expressed a surprising amount of optimism about the potential for his legacy to survive a Republican president and Congress.

Obama said he felt he had accomplished "seventy or seventy-five percent" of what he wanted to do upon taking office. "Maybe fifteen percent of that gets rolled back, twenty percent," he told Remnick. "But there's still a lot of stuff that sticks."

With Trump, Paul Ryan, and Mitch McConnell gunning to repeal, roll back, or gut just about everything Obama did over the past eight years, this is a startling statement. I’d be lying if I said I knew for sure Obama was right about the percentages; so much depends on the particularities of Congress over the next few years, and the prognosis for progressives is certainly grim.

But it’s worth considering the case for optimism. While Republicans have taken aim at high-profile policies like Obamacare and the president’s landmark deals with Cuba and Iran, lesser-known White House moves that have largely flown under the radar will likely survive.

His court appointments have resulted in rulings that are unlikely to be overturned, including the Supreme Court’s landmark decision legalizing same-sex marriage. Less controversial legislation that he’s shepherded through will likely remain, including major parts of the 2009 stimulus package and a crackdown on smoking. And while Obamacare almost certainly will not survive in its present form, developments since the election suggest the law has changed the facts on the ground in a way that puts Republicans under immense pressure to at least partially preserve its coverage gains.

Before the election, I thought Obama’s legacy ranked him alongside FDR and LBJ as a prime architect of the American welfare state. Trump, Ryan, and McConnell are set to greatly diminish that legacy. But they will not erase it.

What of Obamaism will remain

When fans of the administration think of the Obama administration’s accomplishments, the first things that come to mind are the Affordable Care Act, Dodd-Frank financial reforms, climate change regulations, the opening to Cuba, and the historic nuclear deal with Iran. Critics point to the sluggish recovery, growth in inequality, and growing instability in the Middle East.

But like most presidents, Obama managed to get a surprising amount of less individually consequential, but cumulatively quite important, legislative and regulatory work done, work that it’s much more doubtful Republicans will try to undo. The Washington Monthly has a tremendously useful list of Obama’s top 50 accomplishments, which after No. 10 or so starts getting into laws and rules that Donald Trump and Paul Ryan are less likely to uproot. Here are just a few examples.

Liberal judges last for decades: By appointing Sonia Sotomayor and Elena Kagan to the Supreme Court, Obama not only kept two important seats in liberal hands for decades to come but also built the majority that made same-sex marriage the law of the land (as he, personally, was signing legislation ending the military’s ban on gay service members). The Court also struck down severe abortion restrictions in Texas and freed 46,000 prisoners in California.

The Supreme Court is not liberal by any stretch of the imagination, and not being able to appoint Merrick Garland prevents the emergence of a new liberal era on the Court, but the Sotomayor and Kagan appointments had real impact that due to the power of precedent will be difficult to reverse. The Court operates on the principle of stare decisis, where most earlier decisions are honored even by justices who disagree with their conclusions. More to the point, Trump will initially only get to replace Antonin Scalia, who resisted the landmark decisions Sotomayor and Kagan joined in the first place.

But the bigger gains have been at the lower court level. Obama has appointed over 300 district and circuit court judges, and the list is pretty diverse. He’s appointed more women and Latino judges and as many black judges as any previous president, and more Asian-American and LGBTQ judges than all previous presidents combined. He’s also flipped control of most circuit courts of appeals. As the Washington Monthly notes, “A majority of judges on nine of the thirteen appeals courts are now Democratic appointees — compared to just one when Obama took office.”

Trump has plenty of spots to fill as well, which will probably turn some of those courts. But Obama’s appointees will remain to counter Trump’s new ones.

Billions for clean energy: The 2009 stimulus package was, among other things, the largest public investment in renewable energy in American history, with some $90 billion devoted to increasing deployment, funding research and development, and more. That effort “helped quadruple U.S. wind power [and] put the first 400,000 electric vehicles on American roads,” per Michael Grunwald, whose book The New New Deal goes into detail about the difference this spending made.

That progress — the tremendous gains made by solar and wind over Obama’s presidency — won’t be undone, even if Trump ends all future R&D for renewables. The money has been spent. The Trump presidency is going to be a disaster for the climate, to be sure, but in this small way, Obama’s legacy will endure.

Cash for poor children: The stimulus package also included substantial boosts to both the earned income tax credit and the child tax credit. Under the Bush administration, families had to earn at least $10,000 to get a refundable child credit. Since nonrefundable credits are worthless to poor families with no income tax burden, this effectively excluded most of the working poor from this program. So the stimulus reduced the threshold to $3,000. It also increased the EITC for families with three or more children and increased benefits for married couples.

Together, these changes keep 1.8 million people out of poverty and bring 14.6 million closer to the poverty line, according to the Center on Budget and Policy Priorities. As many as 50 million Americans benefited from the changes in some way. After a few extensions, the changes were made permanent in 2015 as part of a bipartisan tax deal signed off on by Paul Ryan. It’s hard to see them going away.

Cracking down on tobacco: In June 2009, Obama signed into law a landmark, bipartisan bill finally giving the Food and Drug Administration authority to regulate tobacco. Previously, tobacco, the deadliest substance in the entire country, was completely outside the purview of Washington’s most powerful and rigorous regulator of consumer food and medicinal products. The agency promptly used its new powers to ban the marketing of “light” cigarettes and crack down on flavored ones that appeal to kids. The law also ordered including graphic imagery illustrating the harms of smoking on cigarette packaging, though that rule has been delayed. The Obama administration also banned smoking in public housing, helping reduce asthma rates and secondhand smoke deaths for nonsmoking residents.

Will Republicans undo this? Maybe — members of the House Freedom Caucus flagged removing FDA authority over tobacco as a regulatory change they’d want. But it’s doubtful they’ll succeed. Back in 2009, 23 Senate Republicans and 70 House Republicans voted to give the FDA that authority. That included people like Senate Majority Whip John Cornyn (R-TX), who actually sponsored the legislation, House Majority Leader Kevin McCarthy (R-CA), House Republican Conference Chair Cathy McMorris Rodgers, and plenty of others still in office. Maybe they’ll all reverse course. But it’s more likely Obama’s major anti-tobacco achievement will remain law.

Fixing student loans: Almost as an afterthought, the Health Care and Education Reconciliation Act of 2010 — the add-on to the Affordable Care Act devised to make subsidies more generous without being subject to a Senate filibuster — nationalized the student loan industry.

Previously, the federal government operated a program where private banks received subsidies to give out loans, which the federal government would then insure. It was a hugely inefficient process that served little purpose other than to increase the cost of offering loans and enriching banks. The legislation reversed that bit of corporate welfare, and increased Pell Grants and made it easier to pay back loans as a percentage of income in the process.

While Trump’s campaign co-chair Sam Clovis has said he wants to get back to a private system of loans, it’s doubtful he’d succeed. Going back to the old system would cost a ton of money, which makes observers like Peter McPherson, president of the Association of Public and Land-grant Universities and a deputy Treasury secretary during the Reagan administration, call the idea “politically untenable.” And Trump has suggested that, if anything, he wants to forgive student loans faster through the income-based repayment process.

Expanding kids’ health care: Trump and Ryan are obviously going to change a lot of the Obama administration’s health care policies, but some will likely escape the scalpel. For example, in February 2009, one of Obama’s first acts as president was to sign into law an expansion of the Children’s Health Insurance Program (CHIP) that expanded coverage by 4.1 million people. Three current Republican US senators — Bob Corker, Lisa Murkowski, and Susan Collins — voted for it, along with 40 House Republicans. When Republicans bring up repealing Obamacare, this effort usually isn’t included.

Remaking K-12 education policy: The 2009 stimulus’s Race to the Top program incentivized states to adopt various elements of the education reform agenda, as interpreted by the Obama administration — stuff like eliminating restrictions on the number of charter schools, more testing and accountability measures, and so forth. Because many of these changes were implemented at the state or local level in order to receive federal funds, they won't be easily undone by Trump. You can like or dislike this part of Obama’s legacy, but it’s real and will stick in some form or another.

The big question mark is Obamacare

And the above list leaves out plenty of other achievements unlikely to be reversed, like preserving the environment through creating national monuments, reducing the sentencing disparity between crack and powder cocaine, cracking down on credit card companies, and causing multiple for-profit colleges to go out of business.

The big question, though, is Obamacare. It’s virtually guaranteed that the Dodd-Frank act will be at least seriously weakened, and while we can safely assume that Donald Trump won’t tear up the Iran and Cuba deals on day one, there is at least a decent chance he will try to renegotiate them. Trump will also jettison the Obama administration’s preferred strategy for resolving the Israel/Palestine dispute and has talked about bringing back torture and sending more detainees to the prison at Guantanamo Bay, Cuba, that Obama tried and failed to close.

Obamacare, however, creates unique challenges. Repealing it could deny health care to more than 20 million people who currently have it — and repealing it without replacing it would cause massive disruption to the individual insurance market, causing mass dissatisfaction that Republicans can ill afford.

Understandably, some Republicans are getting cold feet. Sens. Lamar Alexander, Rand Paul, Susan Collins, and Bob Corker have all expressed doubts about passing a repeal bill without a replacement, which means Republicans might not have the 51 votes they need to do that.

And Republicans are setting ridiculously high standards for what a “replace” bill could look like. Incoming White House counselor Kellyanne Conway told MSNBC's Joe Scarborough, "We don't want anyone who currently has insurance to not have insurance." No plausible replace plan lives up to that; if it’s a real standard Republicans are to be held to, their plans will have to become vastly more generous, and more similar to Obamacare in their spending levels.

There are a few ways this could play out in the end. One is that Republicans just go ahead and repeal without replacing. The individual market tanks, millions lose insurance over the first year or two as the market collapses, and in a few years many millions more lose their insurance after the GOP doesn’t get around to passing a real replacement. All the gains of Obamacare are lost.

But that’s not the only possible scenario, nor even the likeliest. Repeal and replace could happen simultaneously, in late 2017 or early 2018, with the replacement bill mitigating the coverage losses that come with repeal. Friendly estimates from conservative modelers suggest that Paul Ryan’s replacement plan, for instance, would reduce coverage by 4 million; that’s likely too low, but even if the number is 10 million, that’s far better than repealing with no replacement. Obamacare’s legacy will be halved, not eliminated.

And it’s possible that rampant congressional disagreement about how to do a replacement, and opposition to repealing without replacing, will result in Congress failing to pass anything before the midterms, which could see the GOP lose seats in both Congress and the Senate and make passing any type of bill unlikely. That’s not where I’d place my bets, but reaching consensus with a narrow Senate majority is tough. A replacement that’s generous enough to keep Susan Collins on board might be too generous for Ted Cruz.

If Obamacare somehow survives intact due to Republican legislative fracturing and failure, then Obama’s greatest achievement, the culmination of a century’s worth of fighting for a national health program, will live on. But even if it survives in diminished form, it will have altered the political landscape and rendered it untenable for Republicans to simply return to a status quo where more than 20 million Americans lacked any form of insurance. That’s not quite as transformational, but it’s enduring change nonetheless.