In Barack Obama’s final speech as president, he touted nearly a decade of economic improvement. “If I had told you eight years ago that America would reverse a great recession, reboot our auto industry, and unleash the longest stretch of job creation in our history… you might have said our sights were set a little too high,” he said to great applause. But despite his cheery retrospective, the outgoing president also had words of warning, particularly about the important link between the country’s political stability and its economic health. A polarized country, he suggested, is the fastest route to economic ruin. Likewise, a dysfunctional economy will produce political polarization. They are inseparable.

Looking at where the economy stood when Obama took office in January of 2009, it’s impossible to deny the progress that has been made. “Today, the economy is growing again; wages, incomes, home values, and retirement accounts are rising again; poverty is falling again. The wealthy are paying a fairer share of taxes even as the stock market shatters records. The unemployment rate is near a 10-year low,” Obama said.

While many would dispute whether the tax code is indeed "fairer," the fact that the 44th president entered office during one of the worst recessions in recent memory and leaves an economy significantly stronger than he found it is a point of fact. As my colleague Bourree Lam wrote, the final jobs report of the Obama presidency showed that he presided over 75 months of consecutive job growth, a feat surpassing many of his predecessors—though one that was partly enabled because the job loss sustained during the early years of his administration was so staggering. At the end of his term, the unemployment rate will hover below 5 percent—half of where it was at the nadir of the recession. And while there’s been much debate about the quality of the jobs added, and criticism of the decreasing labor-force participation rate, in the last year of Obama’s presidency the economy showed a long-awaited sign of strength: wage growth.

But despite these gains, the economy still shows signs of weakness. And in his farewell speech Obama addressed the fact that many middle- and low-income Americans continue to struggle with underemployment, insufficient wages, and higher costs of living, even as a small portion of wealthy Americans grow richer. This uneven progress isn’t just frustrating, it’s a threat to the basic tenets of fairness and possibility that fuel faith in the country, he suggested. “Our democracy won’t work without a sense that everyone has economic opportunity,” Obama said, touching on inequality and social mobility, two issues that have been referenced again and again during his administration.

In the wake of Donald Trump’s election, one couldn’t help but remember that this growing inequality was a focus of both parties during the election. The GOP blamed it on Obama and democratic policies, a position that seems to have brought to the polls a very specific base of working-class white voters, frustrated by job loss and limited economic mobility. Obama spoke to this dynamic, if somewhat indirectly, “While the top one percent has amassed a bigger share of wealth and income, too many families, in inner cities and rural counties, have been left behind—the laid-off factory worker; the waitress and health care worker who struggle to pay the bills—convinced that the game is fixed against them, that their government only serves the interests of the powerful–a recipe for more cynicism and polarization in our politics,” he said. In these statements, Obama attempted to bridge the gap between Americans who share the burden of economic suffering but remain divided within the electorate by region, race, occupation, and political affiliation.

But more than a salve between the groups, Obama’s statements also contained a warning for those wooed by Trump’s promises to bring back jobs in middle America and the Rust Belt—those who feel that they would still be thriving economically if not for Democratic policies. “The next wave of economic dislocation won’t come from overseas. It will come from the relentless pace of automation that makes many good, middle-class jobs obsolete,” he said. His prescription for this future threat stands in direct opposition to Trump’s platform of locking out foreign workers, closing borders, and lowering both individual and corporate tax rates: “We must forge a new social compact—to guarantee all our kids the education they need; to give workers the power to unionize for better wages; to update the social safety net to reflect the way we live now and make more reforms to the tax code so corporations and individuals who reap the most from the new economy don’t avoid their obligations to the country that’s made their success possible.”

Obama, predictably, ended on an optimistic note, asking Americans to be vigilant but not afraid, and to find more common ground than reason for division. The economy, he reminded, doesn’t have to be a zero-sum game.