It’s hard to imagine, now that Donald Trump is president, but there was a time, a less genuine time to be sure, when politicians didn’t just say things. They scripted things. Messaging often went through advisers, editors, and often focus groups before making it to the candidate’s lips.

Less than two months before Election Day, Hillary Clinton gave a speech at an LGBT fundraiser in New York City. Breaking down the electorate she said, “you could put half of Trump's supporters into what I call the basket of deplorables.” It wasn’t a gaffe. It wasn’t slip of the tongue. It was a scripted line, that New York Times reporter Amy Chozick reports, was developed over glasses of chardonnay.

In her new book, Chasing Hillary: Ten Years, Two Presidential Campaigns, and One Intact Glass Ceiling, Chozick details how the Clinton public relations assembly line went haywire. And it is ugly.

Campaign Manager Robby Mook split the opposition into three groups: 1) “Republicans who hated her, 2) Voters “who feel that the government has let them down, the economy has let them down, nobody cares about them,” and 3) “The racist, sexist, homophobic, xenophobic, Islamophobic.”

Clinton and company packaged that last group up and put them in a basket, a basket of deplorables.

“The Deplorables always got a laugh, over living-room chats in the Hamptons, at dinner parties under the stars on Martha’s Vineyard, over passed hors d’oeuvres in Beverly Hills, and during sunset cocktails in Silicon Valley,” Chozick writes.

And so at a fundraiser in New York City, feeling confident (and a bit petty), Clinton and her aides used the line that “always got a laugh.” They called half of the country deplorable and they lost the election.

All the message-testing in the world, it turns out, can’t save a candidate from her own narrow-minded elitism.