An hour before the last presidential debate of the 2012 campaign, held at Hofstra University, I was at a nearby hotel, pounding whiskey to keep from vomiting.

Two weeks earlier, in Denver, President Obama had lost his first debate against Mitt Romney. It wasn’t close — the verdict was rendered just 10 minutes in by the Twittersphere and the live dial tests of undecided voters running across the bottom of the screen. But the collective freak-out that followed reached new heights of pundit hysteria.

“Liberals Livid With Obama’s Debate Performance” and “Does Barack Obama Really Want to Be President?” were two representative headlines, though the biggest bag of Depends went to conservative commentator–turned-Obama fan Andrew Sullivan. In an understated piece titled “Did Obama Just Throw the Entire Election Away?” he wrote, “I’m trying to see a silver lining. But when a president self-immolates on live TV…and a record number of people watch, it’s hard to see how a president and his party recover.”

OK! Not good. The panic was also fueled by (and fueled) the public polls. Pew and Gallup showed Romney in the lead nationally for the first time (outside the margin of error). A respected Florida poll had him up 51 percent to 44 percent. According to Nate Silver, Obama went from an 86 percent chance of victory on October 4 to a 61 percent chance on October 12. The End of Times was near.

Our own pollsters and data geniuses told us not to worry — that following the debate, the only voters moving toward Romney were Republicans he had lost after his 47 percent gaffe. The basic structure of the race hadn’t changed, they promised, and the president merely fell back to the narrow lead he had held throughout most of the campaign.

“Sure, I get that, makes a lot of sense,” is what I said out loud to this sound, rational explanation.

“We’re fucked. Fucked!” is what ran through my head every second of every day.

I worried that the president wouldn’t fare much better in the next two debates. For starters, Obama hates debating. The first time I helped him prep, in August of 2007, he couldn’t stop complaining about the phony, gladiatorial nature of these performances, which are often a highly subjective test of style and demeanor over substance and accuracy. Points are awarded based on the quality of a candidate’s zingers, while punishment is inflicted for each gaffe. Entire debates have been lost due to a sweaty brow, an audible sigh, a glance at a watch, or any kind of gesture or body language that we collectively judge as un-presidential. Avoid all of this, and you just may be the next commander in chief.

“These debates are not on the level,” I told Obama.

“They’re not on the level!” he shouted in agreement. But I hadn’t intended to egg him on, and agreed with the rest of our team: It was pointless to rail against a game that couldn’t be changed. The only choice was to play it better.

Our candidate improved over time. In 2008, Obama became more disciplined and energetic during his many primary debates with Hillary Clinton, and he won all three debates against John McCain.

After almost four years in the White House, however, the president was not in fighting shape, which is to say that he viewed the debate against Romney as any normal person might: “This guy keeps telling everyone I’m doing a bad job, so here’s my chance to prove him wrong with facts and reason.” He kept asking for more policy briefings. He would speak in wonk and throw out acronyms during prep. If a question about health care came up, he wouldn’t talk about how many Americans had health insurance because of Obamacare, he would defend the “IPAB” or talk about “bending the cost curve.” We would laugh-cry every time he said it.

There were two other problems that contributed to the loss in Denver. The first had to do with Obama understanding, but not necessarily embracing, our strategy — which, in fairness to the president, was sometimes conflicted. “Act presidential,” we told him, “but use these five attacks.” Counterpunch when hit, but quickly pivot to a positive message. Be authentic and passionate, but please memorize this list of zingers and one-liners. Imagine all of this advice floating around in your head when you have no more than two minutes to formulate an answer on live television.

Romney presented the final challenge. We anticipated that he’d sound more like the moderate former governor of Massachusetts than the self-described “severely conservative” candidate from the Republican primary, but we weren’t quite prepared for how thoroughly Romney would Etch A Sketch his most unpopular policies. And we underestimated how affable, confident, and charming he would seem. In the first few moments of the debate, the president delivered what sounded like — and was — a scripted line about his wedding anniversary, which was that evening: “[Michelle, I want to] let you know that a year from now we will not be celebrating it in front of 40 million people.” Romney, who had prepared for just such a line during prep, delivered a retort that got a bigger laugh: “I’m sure this was the most romantic place you could imagine — here with me!”

Things got worse from there. Obama certainly didn’t “self-immolate,” but he did far too much defending, explaining, and even complaining. The conventional wisdom was that he looked like he didn’t want to be there. For once, I couldn’t disagree.

There was no shortage of advice for the president in the weeks following Denver. Most had a “next time, decapitate the bastard!” flavor to it, with the important exception of Bill Clinton’s. The former president, one of the only people on the planet to have been in Obama’s shoes, cautioned against an overcorrection. “No one’s ever won the second debate by winning the first,” he said at a fundraiser a few days before we hunkered down for another round of prep in Williamsburg, Virginia.

It was smart, right, and easier said than done. During a mock debate that was held only 48 hours before the real thing at Hofstra, the president performed worse than he had in Denver. He was too wonky, long-winded, and focused on relitigating the past four years. He sounded angry at Mitt Romney (played by John Kerry), Candy Crowley (played by Anita Dunn), and even a few of the town hall questioners (played by us, the prep team).

The next morning, the president said that he knew what needed to be fixed, but wasn’t sure he could fix it. He was instinctively resisting the artifice involved in a presidential debate. He was still preparing as if the entire thing were on the level.

In the Aaron Sorkin version, this would be the moment when the silence is broken by a hardened-but-ultimately-idealistic adviser who saunters over to the dry erase board, picks up a red marker, and scribbles the following in huge letters, with a few underlines for emphasis: “LET OBAMA BE OBAMA.” Strategy documents would be shredded, the music would swell, and we’d cut to a scene where the president delivers an off-the-cuff, from-the-heart, barn-burner of a debate answer that reduces Mitt Romney to a pile of dust.

This is not the Aaron Sorkin version. We couldn’t just let Obama wing it, but we could give him a playbook that was true to his strengths and instincts. If the president wanted to talk policy, fine, but he should talk about his plans for the future, not argue about the past. Show passion on behalf of people, not anger toward Romney. Execute your strategy, don’t worry about his. Advocate, don’t explain. Inspire, don’t lecture.

Instead of giving the president canned lines and zingers, we tightened and sharpened the answers he had already given. We pared them down to a single debate-on-a-page of “big moments” that Obama agreed to hit no matter what. Then, with the time we had left, he practiced — over, and over, and over. We would ask questions on specific issues 10 different ways, until he gave the same answer every time. And as the day went on, they were faster, clearer, tighter, and better.

Was he ready? I had no idea, which is why I was drinking at the bar of a Long Island Marriott a few hours before the debate. The president seemed much happier than he’d been in Denver. He seemed eager, even excited, to get back on the stage with Romney — not because he wanted to get it over with (which is what he said before Denver), but because he couldn’t wait to make his argument. And this time, he actually had one.

The first question came from a college student who asked about finding a job after graduation. Romney gave a solid answer, and at one point said, “It’s not going to be like the last four years. The middle class has been crushed over the last four years.”

I watched as Obama stood up, and prayed that the president wouldn’t take the bait. Then he walked over to the student, and began: “Jeremy, first of all, your future is bright.” Optimism. “The most important thing we can do is to make sure that we’re creating jobs in this country.” Future. “Number one…” Plans: for manufacturing, education, energy, infrastructure, all in a few quick, tight sentences. “Now, when Governor Romney said we should let Detroit go bankrupt…” Contrast, not too nasty, lifted right from the debate-on-a-page. He was off and running.

Backstage, we finally exhaled. As the president went on to deliver almost every moment we had practiced, we cheered. And by the time Romney was fact-checked by Candy Crowley for insisting multiple times that Obama didn’t call Benghazi an “act of terror” on the day after the attack, when the transcript clearly showed that he had, we knew it was over. This time, Romney was rattled and angry, while Obama was confident and passionate.

On Monday, two very different candidates will take the stage at Hofstra University. Hillary Clinton can’t know whether she’ll face a nice or nasty Donald Trump, but either way, she can prepare to be a fierce advocate for her vision, for the people counting on her, and for the values that motivate her. She can execute her own strategy, and like the man she’s running to replace did, practice answers and moments that are true to who she is and what she believes. The president certainly didn’t love the game, and probably never will. But at the moment that mattered most, he learned to play it quite well.