WASHINGTON ― Democrats didn’t simply win in places they expected to on Nov. 6. They also managed to flip districts Donald Trump won easily in the 2016 presidential election, as well as some districts that have been held by Republicans for decades.

The secret to their success was a fairly conventional, but somewhat surprising, campaign strategy during an election year that was mostly seen as a referendum on Trump: Talking about anything but the president.

Democrat Kendra Horn, for example, pulled off one of the biggest upsets of the night when she defeated two-term incumbent Steve Russell in Oklahoma’s 5th Congressional District, a seat held by Republicans since 1975. Horn is the first Democratic woman to be elected to Congress from Oklahoma. Moreover, she’s the third woman ever to be elected to Congress in the state’s history. Her largely urban district went to Trump by almost 14 percentage points, prompting skepticism among national pollsters that it would be one of the seats that would flip this year.

“I think many people thought I might have lost my mind,” Horn recalled last week at a post-election debrief in Washington, where she reflected on the moment she chose to run for office. “I just believed in the power of talking to the community and saw there was a pathway there. I figured, if not me, who? If not now, when?”

Horn campaigned on left-wing issues like gun control, stricter campaign finance regulations, opposition to private prisons, and more funding for education ― an issue that especially resonated with voters after an unprecedented strike by Oklahoma teachers this year. The GOP-controlled state slashed public school funding significantly since the Great Recession, while also pursuing tax cuts that have benefited businesses and the wealthy. The budget shortfalls left no money to pump into schools or salaries, leading to teacher shortages, overcrowded classrooms and even four-day school weeks.

“What we were hearing about was not the president, it was about education, it was about health care,” Horn said at the event, organized by political data firm TargetSmart. “We had a massive teacher walkout in the spring, so education loomed particularly large. ... That really, really kept us out of that national narrative. If we were trying to follow that, it was like this ping pong, and that’s not what people, when you got down to it, are concerned about.”

Horn resisted attempts by Russell to turn the race into a debate on national issues, avoiding direct criticism of Trump and associations with House Minority Leader Rep. Nancy Pelosi (D-Calif.). It was a critical calculation in a state the president won more than 36 points in the last election. Focusing on the eye-catching headlines coming out of Washington, she explained, ”would have been a no-win space” for her campaign.

Winning over traditionally conservative voters also helped moderate Democrat Jeff Van Drew defeat a right-wing Republican in New Jersey’s 2nd District. The coastal South Jersey seat went up for grabs this year after GOP Rep. Frank LoBiondo decided to retire after 24 years in office. Its residents voted for President Barack Obama twice before swinging to Trump in the 2016 election.

Granted, Van Drew was fortunate enough to have an extremely flawed opponent in Seth Grossman, who was abandoned by his national Republicans because of his bigoted statements about minorities and diversity. But Van Drew, a dentist and a state senator, didn’t take the race for granted. He honed his pitch to Republican voters who liked Trump, but not some of his policies like offshore drilling.

ASSOCIATED PRESS Democrat Jeff Van Drew, a moderate, won a district in New Jersey that voted for Trump in the 2016 election.

“I think the big trick in a red district is to prove to folks you are running against a particularly bad Republican,” Van Drew said. “So that they can feel like, ‘Oh I’m still Republican, but this one I’m not voting for.’”

Figuring out how best to approach wary Trump supporters wasn’t always easy. Van Drew recalled meeting a married couple at a county fair who disagreed on how best to deal with Trump. While the husband seemed more apprehensive about Van Drew’s answer on standing up to the president when the situation called for it, the wife urged him to “knock [Trump] down and go after him ― whatever you can do, go after him.”

The most challenging aspect of the election for Van Drew, however, may have been overcoming deep-seated partisanship among the electorate. With talk of a blue wave before November, losing control of the House weighed heavily in the minds of many Republican voters who otherwise may have been more open to voting for a Democrat.

“So many people came up to me and said, ‘I really like you I want to vote for you, I do think we need some change but, quite frankly, I don’t want to flip the House. I’m a Republican, I don’t want to flip the House. I think it’s dangerous,’” Van Drew recalled. “That’s a hard argument to have. ... That made it certainly more challenging.”

Democrats dealt with the problem by having their candidates use more amorphous code words, like “dysfunction,” and “chaos,” to call for change in Washington, instead of attacking the president directly. It’s a messaging strategy that is ironically similar to the anti-establishment “Drain the swamp” rallying cry that Trump and his campaign used in the 2016 election, one his administration has failed to deliver.

“It’s not just President Trump, it’s the Washington system right now. It’s about changing everything,” said Kerry Gooch, the campaign manager for Democrat Paul Davis, who narrowly lost a Kansas congressional seat that Trump carried by 18 points. “Our whole campaign was about inspiring people, about giving people something to hope for. We tried as much as possible not to talk about what was going on in Washington, but instead, change the conversation to what we can do together.”