Image copyright AFP/Getty Images Image caption The final Democratic debate before the Iowa caucuses was full of energy - and interruptions

Two weeks until the Iowa caucuses and the American media has been full of headlines about Clinton campaign drama. Is this a repeat of 2008 when Hillary Clinton underestimated her opponent, Barack Obama, and ended up in third place?

Should the Clinton campaign have pushed for more debates, a format she excels at, instead of settling for six debates, most of which are taking place at times when viewership is low, like the last debate this Sunday night, on a long holiday weekend?

There is cause for concern. Mrs Clinton's main challenger Vermont Senator Bernie Sanders has closed in on her in Iowa, the state that kicks off the nomination race with caucuses on 1 February. The race is now too close to call. In New Hampshire, which will hold its primary on 9 February, Mr Sanders is leading in the polls.

There has been much hand-wringing by unnamed aides and allies quoted in newspaper articles about the unlikely challenge mounted by a 74-year-old socialist. But as early in the race as July last year, a senior Clinton aide told me the campaign was already looking at the possibility that the former secretary of state could lose Iowa and New Hampshire (which borders Vermont) and was working on building a firewall in the southern states to stop Mr Sanders in his tracks.

So while the Clinton team would no doubt have preferred that the race unfold differently, they were not blindsided either.

Losing ground

Mrs Clinton still has a two-digit lead in the national polls and if she is nervous about her vulnerability in the two early voting states, she did not show it on the debate stage. She came prepared to emphasise her differences with Mr Sanders in a debate that was the most heated so far on the Democratic side.

Image copyright AFP Image caption Mrs Clinton - normally the darling of the debating chamber - now faces an unlikely challenge for the Democratic nomination that has been mounted by a 74-year-old socialist

Image copyright AFP Image caption There has been something unpredictable this year in the race to secure both the Democratic and Republican party nominations

Image copyright Getty Images Image caption Mrs Clinton's daughter Chelsea (left) has been avidly campaigning for her mother in New Hampshire

The two clashed often on the issues of healthcare, gun control and Mrs Clinton's ties to Wall Street. The third candidate, former Maryland governor Martin O'Malley was barely a blip on the radar.

But Mrs Clinton did not try to match Mr Sanders' populism or lurch further left out of fear that she was losing ground (except on gun control, where she has been to the left of Mr Sanders since the start of the race).

Her performance was solid, not scintillating, but she made no mistakes. It was anchored in pragmatism and incremental change. Mostly it was about continuity: She embraced President Barack Obama's legacy warmly and repeatedly.

The president's approval rating among Democrats stands at 78%.

By tying herself to the president, Mrs Clinton was also reinforcing her ties with African-American voters, a crucial constituency for her.

Her performance seemed designed to imply confidence that she would win the nomination while maintaining her appeal to voters in the general election in November.

But Mr Sanders also made a very strong pitch, describing his campaign as "a political revolution to not only elect the president, but to transform this country".

When he was asked about his troubles connecting with minorities, especially African-Americans, Mr Sanders said that the more they got to know him, the more they would support him.

Image copyright Getty Images Image caption Mrs Clinton says that she is eager to continue the legacy of President Obama

Image copyright Reuters Image caption Mrs Clinton is eager to reinforce her ties with African-American voters, a crucial constituency for her

"We have the momentum, we're on a path to a victory," he said.

But it will be a hard climb, because of the firewall that Mrs Clinton worked hard to build in the south, starting with South Carolina (SC), the first state to vote in the south on 27 February.

The Clintons have deep ties and a long history in the south. In an election where "New York values" have been hurled at brash Republican candidate Donald Trump as an insult, Mr Sanders' Brooklyn upbringing does not sit well with everybody in this area.

"Bernie is a great guy, he's got a great personality, but Hillary Clinton will win South Carolina, no doubt about it," said Don Baker, a Charleston architect who was attending a predominantly African American Democratic Party gathering on Saturday where all three candidates spoke.

"Her mannerisms are more likeable to southerners. Bernie is too straight to it."

Chairman of the SC Democratic party, Jaime Harrison, agreed without taking sides in the race.

"Unless Bernie figures out how to pull African-American women to his side, it's going to be tough," he said.

Mr Harrison urged Mr Sanders to visit salons, barbershops and churches to connect with voters.

On 1 March, 12 states will hold their primaries and the black vote will be key for Mrs Clinton. In between, Nevada will hold its caucuses, a state where she has been heavily courting the Latino vote.

Even if Mr Sanders does not make it to victory, his campaign has managed to inject energy and enthusiasm into the race, especially among young voters. Mrs Clinton's aides insist they always wanted a competitive race.

Image copyright Reuters Image caption Mrs Clinton embraced President Barack Obama's legacy warmly and repeatedly

But there has been something unpredictable about this election season, on both sides. After having been dismissed as a joke, with predictions that his campaign would implode, Republican candidate Donald Trump is not only leading in the national polls, but doing so with a double-digit lead.

On both extremes of the political spectrum, Mr Trump and Mr Sanders are connecting with a deep-seated anxiety among voters. Although their messages and solutions are polar opposites, their appeal to disillusioned Americans has helped fill huge auditoriums with supporters, more than all the other candidates combined.

Victories for Mr Trump and Mr Sanders in either or both of the early states could create a momentum for the more revolutionary, angry mood in both parties.

Clinton aides did not want to speculate on the impact this dynamic could have on the former secretary of state's campaign.

In a national match up against Mr Trump, polls currently show Mr Sanders would win while Mrs Clinton would lose.

In the spin room after the Charleston debate, Mrs Clinton's campaign manager Robby Mook said they were working hard for every vote and were ''ready to go deep'' in the map to win the nomination.

For now, all the focus is on Iowa and New Hampshire, with both Mrs Clinton and Mr Sanders campaigning relentlessly in the two states over the next 15 days.