After the White House Correspondents Association dinner, as reporters, celebrities and politicos mingled at a handful of after parties, the buzz centered on one question -- how was it that President Obama was so much funnier than Jay Leno?
Leno was the professional comedian booked by the correspondents association to entertain guests at the annual dinner.
But it was Obama who brought down the house by sticking to the key, unofficial rules for presidential comedy -- self-deprecating humor, perfect to diffuse sticky political situations.
The president's 17-minute bit was written by two of his speechwriters, Jon Favreau and Jon Lovett, with input from a writer from "The Daily Show;" Jeff Shesol, a former Clinton White House speechwriter, and Jeff Nussbaum, a Democratic speechwriter who is one of the go-to guys in Washington when a politician has to moonlight as a comedian.
Obama opened up by acknowledging that since he spoke at the same dinner last year, times have changed for both him and NBC's one-time late-night comedy leader.
"I am glad that the only person whose ratings fell more than mine last year is here tonight -- great to see you, Jay," the president said to laughter from the dinner crowd of about 2,700 guests.
Obama said he was glad to be first up at the podium -- "because we've all seen what happens when somebody takes the time slot after Leno's," the president said. It was a well-aimed zinger, after NBC tried to move Leno to prime time -- and when it failed, moved him back to late-night, bumping Conan O'Brien from "The Tonight Show."
A president always gets a respectful audience during a stand-up routine because first, he is the president, and second, the audience understands that comedy bits are not part of his job description.
But the audience Saturday night seemed to laugh genuinely at the presidential one-liners; Obama got more than polite applause.
So why did the president earn such reviews?
Dinner guests told ABC News that his timing was perfect, he was enjoying himself and he was edgy. He threatened to strike down the Jonas Brothers with predator drones if they hit on his tween daughters. He played on the conspiracy theories about his lack of a birth certificate proving he was born in the United States.
"By the way, all of the jokes here tonight are brought to you by our friends at Goldman Sachs," the president said. "So you don't have to worry -- they make money whether you laugh or not."
The Washington Examiner's Julie Mason said it was the president, not Leno, who brought the laughs on Saturday night.
"He seemed really relaxed and loose on Saturday, very affable," said Mason, who serves on the White House Correspondents Association board and sat on stage with the president and Leno.
In the opinion of one television reporter, Leno, who relied heavily on notecards and seemed to rush through his punchlines, "mailed it in."
"What was that? Maybe he was insulted by the president's time-slot joke?" the reporter asked.
The general sentiment among many dinner guests was that a professional comedian is a key part of the night's lineup, but perhaps there should be an effort to book someone with more edge, like Chelsea Handler or Jimmy Fallon.
But Mason said that can be tricky and it is important to remember who is at this dinner.
"The problem is finding ones who don't do a lot of profanity -- I think a lot of us would love to get Chris Rock, for example, but his act is too extreme for the stodgy old White House dinner," she said.
One reporter quipped that beyond Obama and Leno, perhaps the biggest credit should go to WHCA president Ed Chen "for cutting down on the epic program and getting the audience to shut up and listen."
For the president and other politicians who dare to take a turn at comedy, such routines require a significant amount of preparation, rehearsal -- and guts.
So why do politicians ever agree to do this? Why take a chance that jokes will fall flat and routines will bomb?
Several comedy writers who have worked with lawmakers on these kinds of appearances told ABC News that a stand-up comedy act is a powerful tool to show that politicians don't take themselves too seriously, and it gives them a chance to bask in a more forgiving spotlight.
"There is a tradition to doing these things, a prestige to do these kinds of events," said Eric Schnure, a veteran political speechwriter and comedy writer. "I think the driving force is that politicians are in the business of having people like them and it's not as much getting laughs as it is being liked."
Schnure said that humor is one of the few things that can go a long way to humanizing a politician.
"It's an incredible opportunity to get a warm response from a crowd who is usually skeptical of you -- the media," said another veteran comedy writer. "And it's an incredible opportunity to be self-deprecating, which is really endearing."
Landon Parvin, who has written comedy routines for several Republican presidents, including former President George W. Bush, said these speeches are "another means for the public to judge the president."
"People don't get to see a president in that kind of humorous mode very often," Parvin said.
Rule #1 for politicians: "Don't be offensive."
The comedy should be "reassuring, not cutting," Parvin said.
The veteran comedy writer pointed out that while there is an inherent risk to standing in front of a large audience and trying to be funny, there is also a big payoff if successful.
"The reason they put themselves through it is if you are self-deprecating you get up there and say, 'The pressure hasn't gotten to me, I can laugh at myself," Parvin said. "The problems aren't so bad that I can't joke about what's going on.'"
The Gridiron Club's motto -- "Singe not burn" -- is the mantra that these writers adhere to.
For any comedian, there is a fine line between humor and offense. In a town like Washington, where every sentence a politician utters is parsed for hidden or partisan meaning, words really matter.
Schnure said that in order to avoid crossing that line self-deprecating humor is the "fail-safe method."
"Humor is a powerful weapon that is best pointed at one's self," he said. "If they are not willing to be self-deprecating, there is a great risk that people don't just think they're not funny but that they are mean."
Schnure said that the best place to start is to figure out what a politician is known for -- what is the Beltway caricature that can get some laughs?
For some politicians that is easy, and you don't have to look very far past "Saturday Night Live" skits to realize that former Vice President Al Gore is a stiff, Vice President Joe Biden sticks his foot in his mouth, and former President George W. Bush messes up words and is a fake cowboy.
Schnure said embracing those stereotypes can actually bring about the opposite perception. Want to make people think you aren't a stiff? If you are Gore, then loosen up just a little bit and make jokes about being a stiff.
"You can diffuse issues, you can change perceptions," he said.
When politicians turn the one-liners away from themselves and toward their colleagues, they run the risk of packing too powerful of a punch.
"Humor is a weapon that if you wield on others, you first need to wield on yourself," said one writer. "Because of the position of power these people hold, everything they do or say is amplified so they have to be careful."
At the White House Correspondents Association dinner last year, Obama pointed out that he has a lot in common with House Minority Leader John Boehner, who is known for his bronze glow even in the dead of winter.
"We have a lot in common. He is a person of color," Obama said. "Although not a color that appears in the natural world."
The line got hearty laughs, but in hindsight, some writers thought it maybe was too pointed a jab.
"The president has a lot of power and zingers do not work because they have too much power behind it," Parvin said. "If a president makes fun of himself, he says, 'I am just like you.'"
Humor is often a key way for lawmakers to diffuse a tense political situation.
In 2002, then-Senate Majority Leader Tom Daschle was under fire from Republicans who said he was blocking President Bush's legislative agenda.
At the Gridiron Club dinner that spring, Daschle took the criticism and turned it into a punch line aimed at him.
"Hi, my name's Tom. I'm an obstructionist," he said to laughter.
Daschle added that during the dinner Bush asked him to pass the salt, but quipped "I can't bring myself to pass anything."
The routine may not have completely thawed the partisan chill between the Bush White House and the Democratic majority but it did get a laugh.
"He really lanced that boil," one veteran writer said of Daschle's zinger. "That's what humor allows you to do."
Last spring the Obama White House was under fire for the authorization of an Air Force One photo-op that terrified New York City area residents who saw the low flying plane.
Obama used his remarks at the White House Correspondents dinner to admit that mistakes were made and tried to jokingly pass the buck.
"Now Sasha and Malia aren't here tonight because they're grounded," he said of his two daughters.
"You can't just take Air Force One on a joy ride to Manhattan. I don't care whose kids you are. We've been setting some ground rules here," he said. "They're starting to get a little carried away."
But while humor can be a great tool to diffuse political tensions and recast a narrative, a bad joke can also exacerbate partisanship and offend.
In 2004, President Bush did a slide show presentation of photos from inside the White House and poked fun at himself and the elusive search for weapons of mass destruction in Iraq.
"Those weapons of mass destruction have got to be somewhere," Bush joked as a photo of him on his hands and knees appeared on large screens. "Nope, no weapons over there ... maybe under here?"
Though the audience laughed at the time, the reaction after the dinner was not as charitable.
Democrats in Washington jumped on the president for the bit, saying it was insensitive when American men and women had died in Iraq as the search for WMD turned up nothing.
"You always want to be wary of bad taste," one writer said.
Most politicians will hire someone who has experience in this field, rather than just rely on their own staff. Schnure and fellow veteran writer Jeff Nussbaum formed "The Humor Cabinet," which Schnure joked was like a "brain trust" that politicians could turn to when they are asked to deliver a comedy speech.
Politicians prepare for these kinds of speeches much like they would prepare for a policy speech ? with brainstorming sessions with staff, drafts, revisions and rehearsals where special attention is paid to delivery and timing.
The jokes can come from a wide range of sources. One writer said the first step is to give the politician a document with "five times as many jokes as they will need."
"There's usually a pretty fun session where they go through and say, 'love it,' 'hate it,' and there are some there just for their amusement," he said.
There will be discussions about concepts -- do you want to use a slide show of photographs or video? Will you incorporate a surprise guest or stick to a script of one liners?
No matter the format, several writers said that the key thing was for the speech to have an ongoing theme that ties it all together and for the jokes to be topical.
Once the jokes are written and the speech is put together, then it moves to the delivery phase.
One writer said that the jokes are tested on staff first, to see what passes and what falls flat, and then a politician will bring home the act to test it out on friends and family, who will be more inclined to offer constructive and honest criticism.
Parvin said he and Bush had it down to a science.
"Sit down, go over drafts, rehearsal on Friday and then again on Saturday before the event," he said. "We had a history."
Timing is everything and even though politicians are used to delivering speeches from a teleprompter or text, delivering jokes at the right pace can be a daunting challenge.
Biden delivered remarks at this year's Radio-Television Correspondents Association dinner, and he used a slide show of photographs to enhance his jokes. But the slides came up before he delivered the punch line, causing him to grumble about the teleprompter operator and step on his own jokes.
With YouTube and 24-hour cable, the comedy routines are no longer just about the audience in the room but the audience watching at home.
Parvin said that a successful outing can have impact beyond the Beltway elites chuckling in person, and a writer needs to consider that audience as well.
"When you do these things you would be surprised the worldwide coverage they get," he said.
Parvin said Bush frequently heard from other world leaders who liked his jokes. Russian President Vladimir Putin even told Bush how much he liked first lady Laura Bush's turn at the mic at the 2005 White House Correspondents Association dinner, when she stole the show with her jokes about her husband being "Mr. Excitement," asleep at 9 p.m.
"I said to him the other day, 'George, if you really want to end tyranny in the world, you're going to have to stay up later,'" she said to raucous laughter from the audience of journalists and politicians.