WASHINGTON (AP) — Outgoing House Speaker Paul Ryan is bemoaning America’s “broken politics” in a farewell speech in which he calls Washington’s failure to overhaul costly federal benefit programs “our greatest unfinished business.”

“Our complex problems are solvable,” Ryan says in excerpts of remarks he plans to deliver Wednesday at the Library of Congress, across the street from a Capitol where he’s served two decades in the House, the last three years as speaker. “That is to say, our problems are solvable if our politics will allow it.”

The Wisconsin Republican’s address, which touts achievements and admits shortcomings, comes as the window closes on a tumultuous two years of GOP control of government dominated by President Donald Trump. It also comes six weeks after an Election Day that saw Democrats capture House control, which begins Jan. 3.

Under Ryan, Congress approved the biggest tax cuts in decades, boosted defense spending and rolled back regulations protecting clean air and water adopted by former President Barack Obama. But annual federal deficits are surging, Medicare and other expensive entitlement programs are growing and a top GOP priority — scuttling Obama’s health care law — has crashed.

Providing chaotic background music for Ryan’s departure, Congress in its closing days was mired in a struggle to avoid a partial government shutdown as Trump clashes with Democrats over his demand for taxpayer money to build a border wall with Mexico.

In excerpts provided to The Associated Press, Ryan calls the House “the most productive we have had in a generation,” citing passage of more than 1,000 bills, though most were minor. He predicts that the failed GOP effort to repeal and rewrite Obama’s health care law will be the framework for an ultimate solution, and said the party’s fruitless attempts to revamp immigration laws — both the House and Senate rejected bills — came closer that people realize.

“We have taken on some of the biggest challenges of our time, and made a great and lasting difference in the trajectory of this country,” he said.

Yet his comments also underscore some of the GOP’s recent failures.

Ryan, 48, acknowledges he never achieved two longtime policy dreams — reining spending by the government’s huge entitlement programs and controlling the enormous and growing national debt. Thanks partly to the 10-year, $1.5 trillion tax cut Republicans enacted last year, the nonpartisan Congressional Budget Office estimates a record $12.4 trillion accumulated federal deficits for the coming decade.

“I acknowledge plainly that my ambitions for entitlement reform have outpaced the political reality and I consider this our greatest unfinished business,” he says.

While the House-passed health care bill would have culled savings from Medicaid and other programs, the effort died in the GOP-run Senate, killed by solid Democratic opposition and a handful of Republican opponents.

“Ultimately, solving this problem will require a greater degree of political will than exists today. I regret that,” Ryan says.

Ryan was first elected to Congress in 1998 and became a leader of Republicans trying to shrink government. As chairman of the House Budget Committee, he wrote spending plans that envisioned squeezing savings from popular benefit programs like Medicare and eliminating deficits — proposals that Congress never actually enacted.

He announced last April that he would not seek re-election to the House, citing a desire to spend more time with his family.

The excerpts never directly mention Trump. But Ryan describes the divisiveness that has been a hallmark of Trump’s constant demonization of his political opponents, which has included racially tinged statements.

“All of this pulls on the threads of our common humanity, in what could be our unraveling,” he warns.

He suggests that “rediscovering that human connection is one lane on the road back to aspiration and inclusion as the guiding influences in public life.” He adds, “The drivers of our broken politics are more obvious than the solutions.”

On immigration, Ryan says no matter how the border wall battle is resolved, “The system will still be in need of serious reform. And no less than our full potential as a nation is at stake.”

He says resolving the problem is “an economic and moral imperative. And it would go a long way toward taking some of the venom out of our discourse.” Ryan for years was a quiet force for broad immigration overhauls that conservatives opposed as going too far in offering citizenship to immigrants in the U.S. illegally, but he was unable to unify Republicans behind one approach in in this year’s debacle.

The excerpts spend little time discussing last year’s GOP tax cut bill, which Ryan has previously named as one of his most significant accomplishments. He cites that bill’s tax breaks for investors in low-income communities and cautions Republicans to not let efforts to ease poverty “drift from your consciousness.”

Dipping into foreign policy, Ryan says both parties must “devote more time and energy to the direct challenge China poses to the West.” He says that his overseas travels tell him that “our allies wonder whether we are still in the game here.”

Under Trump, the U.S. and China have been having a trade faceoff. Trump has postponed new tariffs on China while the two countries negotiate.