On many days now, Sen. Barack Obama wears an American flag pin in his lapel. He has praised Sen. Hillary Rodham Clinton as a feminist hero. His travel schedule takes him to general-election swing states.

Those are a few of the public signs that Obama has begun trying to patch up political vulnerabilities exposed during the long Democratic campaign, as he wraps up the nomination and seeks to unite a party riven along lines of race, gender and class.

Obama has a daunting to-do list. He must, in no particular order, win over die-hard Clinton supporters, many of them angry at how they thought the first credible female candidate for president was treated; connect with white working-class voters; and figure out how to compete in battleground states like Pennsylvania, Ohio and West Virginia, where he got crushed in primaries.

On top of that, the Illinois senator needs to expand his staff, mesh his campaign with the Democratic National Committee, begin drawing contrasts with Republican Sen. John McCain of Arizona, and (discreetly) start hunting for a running mate. Obama has taken steps toward all of those.

While those are formidable obstacles, the Republicans have worse problems. The party is burdened with an unpopular war, a drooping economy, and huge majorities of voters telling pollsters the country is on the wrong track.

"The Republicans are facing a tidal wave, and there are very few people who can surf a tidal wave," Democratic strategist Saul Shorr said.

This is the first time since 1976 that two evenly matched candidates have battled for a party's nomination so late in the year, and what happened to the GOP back then illustrates the potential danger for the Democrats. That year, President Gerald Ford fended off Ronald Reagan at the convention, and Democrat Jimmy Carter went on to win the White House. In turn, Carter was weakened four years later by a months-long challenge from Sen. Edward M. Kennedy and was not reelected.

During the last generation, each successful presidential nominee has been able to convert better than 50 percent of the states he lost in the primaries to his side in the general election, political analyst Rhodes Cook wrote in a recent report for the University of Virginia Center for Politics.

To win in the fall, Obama "will need to prove himself a coalition builder of the first magnitude," Cook said. "He has not fared all that well in prime battleground states, losing primaries in Pennsylvania, Ohio, Nevada, New Mexico and New Hampshire." Each of those states was decided in 2004 by 3 percentage points or fewer.

Quinnipiac University polls last week in Ohio, Florida and Pennsylvania showed Clinton besting McCain in those states, but Obama leading in only Pennsylvania. The reason: Clinton had double-digit advantages over the Republican in support from women, her strongest constituency.

It was no accident that when Obama went to Iowa on Tuesday night to celebrate coming within reach of the nomination, he was more effusive than ever in his praise of Clinton. Obama called the New York senator "one of the most formidable candidates ever to run for this office" - and a history maker.

"No matter how this primary ends, Sen. Clinton has shattered myths and broken barriers and changed the America in which my daughters and yours will come of age," Obama said. In a litany of turning points in American history, he included this one: Seneca Falls, the 1848 conference in Upstate New York that launched the women's rights movement.

Many Clinton supporters, particularly women, have long believed that the historical nature of her candidacy was lost amid the gushing over Obama, an African American. They also resented what they saw as sexist slights in news coverage and efforts to push Clinton out of the race.

A national Gallup poll of Democratic voters last week found Clinton with the support of 55 percent of women 50 or older.

"We are the most important faction in the party," said Cynthia Ruccia, a Democratic activist from Columbus, Ohio, who started Clinton Supporters Count Too, a group aimed at campaigning for McCain in swing states if Clinton is not nominated.

"We've done the work over the years, stuffed the envelopes, gone door to door, and our candidate has been mistreated and we're being told to sit down and shut up and get to the back of the bus and get with the program," Ruccia said in an interview. "We're not going to do it."

Rep. Allyson Schwartz (D., Pa.), a staunch Clinton backer, said she would campaign hard for Obama if he became the nominee, but shared some of the perceptions.

"It was done in a very nice way, but it was intended to be dismissive," Schwartz said of Obama's praise in Iowa on Tuesday night. "The tone was, 'You've had a good run, and you're done.' "

Obama has also had difficulty attracting votes from working-class whites, contributing most recently to his losses in Ohio, Pennsylvania, West Virginia and Kentucky. Clinton has used this trend to argue that she is the more electable candidate.

"Some of it might be race, some of it an inability to relate to blue-collar people," Democratic strategist Neil Oxman said. "For whatever reason, he needs to make that group of people comfortable voting for him."

The national Gallup poll last week indicated that Obama was closing the gap among white voters of all economic classes.

Even though about a quarter of Clinton voters in recent exit polls said they would vote for McCain rather than Obama if Obama is the Democratic nominee, research suggests the defection rate will be much lower.

"As long as Barack carries the message of economic change and populism, he will reconnect with those voters," Democratic strategist David Dunphy said. "Yes, he may lose some of the older, more conservative Democrats, but most will come home."

Meanwhile, Obama has traveled to several battleground states - Missouri, Michigan, Iowa and Florida - in the last nine days, and this week he plans a Western swing to Colorado, Nevada and New Mexico, states that are increasingly competitive in presidential elections.

His campaign also has started a massive voter-registration drive, hoping to build on success Obama has had attracting new voters in the primaries.

A top Obama organizer, Paul Tewes, is quietly working on a takeover of the day-to-day apparatus of the Democratic National Committee. Nominees use the committee and the state parties to run their field organizing operations.

"To retool a campaign is a big deal," Oxman said. "It needs amazing coordination in just a very practical way."

Contact staff writer Thomas Fitzgerald at 215-854-2718 or tfitzgerald@phillynews.com.