With smoke still rising from the ruins of Hillary Clinton’s defeat, Democrats are fighting for control of the machinery of the national party, and debating how best to counteract President-elect Donald Trump and retool to win future elections.

Outlines of the battle can be seen in the early stages of the campaign for the chairmanship of the Democratic National Committee, pitting the centrist wing of the party that has been in control for three decades – and formed Clinton’s base – against more liberal members aligned with Sen. Bernie Sanders of Vermont, who challenged her from the left.

The candidate getting the most attention so far is Rep. Keith Ellison of Minnesota, co-chairman of the Congressional Progressive Caucus and the first Muslim to be elected to Congress. Sanders has endorsed Ellison, who also has the support of incoming Senate Minority Leader Charles E. Schumer of New York.

The party should be more of an advocate for the working class and less a fund-raising clearinghouse, Sanders argues. "You can’t tell working people you’re on their side and at the same time raise money from Wall Street and the billionaire class," he said recently.

Clinton raised $972 million for her campaign, the DNC and state parties, but many liberal activists say that was outweighed by a fundamental misunderstanding of populist anger and an inability to connect with working-class voters.

"It seems to me Bernie Sanders would have done better than Hillary did," said Gloria Gilman, co-founder of the progressive activist group Philadelphia Neighborhood Networks, who campaigned hard for Clinton after she won the nomination. "The party needs to go back to the grassroots, and Keith Ellison seems like somebody who understands that, who can build on small donations from individuals and get the people involved."

Gilman said she hopes that Clinton’s loss can have an upside, mobilizing liberals in resistance. "Not everybody is stymied by their shock," she said. "There’s some really good organizing going on."

Former Vermont Gov. Howard Dean, who was DNC chairman a decade ago, is seeking the job again. A presidential candidate in 2004, he pursued a strategy of organizing state and local parties in all 50 states, which won the hearts of grassroots activists.

Jaime Harrison, the South Carolina Democratic chairman, is considering running for chairman, as are several Hispanic leaders. Among them are Henry Munoz III, the DNC’s national finance chairman; Labor Secretary Thomas Perez; and Reps. Ruben Gallego of Arizona and Xavier Becerra of California.

Those who favor rejuvenation at the grassroots point to big losses at lower levels of government under President Barack Obama, who often seemed to some more zealous in guarding his own brand than in building the party’s. As of January, Democrats will hold 11 fewer U.S. Senate seats, at least 14 fewer governorships, and about 900 fewer state legislative seats than they did when Obama took office.

The Republicans now has majorities in 69 of 99 state legislative chambers, compared with 36 at the start of 2010. If this trend continues, state legislative dominance will help the Republicans when it comes time to redraw House districts after the 2020 census.

"In a time of introspection, why aren’t we looking at a broad swath of the country for a chairman? said Kevin Washo, former executive director of the Pennsylvania Democratic Party. "We need to try to build an operation and compete in a lot of areas of this country that we have ignored. "We’ve got to be equally comfortable at the bar in the Four Seasons and at Bruno’s Bar in St. Johns, Mich."

Some Democrats, including Washo and Dean, say the next chairman should perform the role full time, arguing that a member of Congress like Ellison might not be able to undertake all the nuts-and-bolts organizing necessary.

At the same time, without a single national figure to act as a political counterweight to Trump, the next party chairman also could be called upon to be as much messenger as mechanic, and that job also can be grueling. It would help if the party came to an agreement on what the message should be first.

"We saw in this election that all the inside voices were wrong," said Rebecca Kirszner Katz, a Democratic strategist who has worked for retiring Senate Minority Leader Harry Reid of Nevada and New York City Mayor Bill de Blasio. "Democrats are hungry to have the party catch up to where the people are."

To Katz, that would mean a more explicit and sustained focus on issues such as income inequality and financial-industry regulation, and more reliance on grassroots energy than on the party’s corporate allies.

Others say a focus on a populist economic agenda might not be enough to attract white working-class Democrats and former Democrats who have been alienated from the party on cultural issues.