China’s President Xi Jinping had a better-than-expected 2017, quietly strengthening his hand both at home and abroad while Donald Trump’s tweets captured headlines around the globe. Next year will put those gains to the test. Here are five key challenges he faces in 2018: 1) Keep the Middle Class Happy China’s economy proved resilient in 2017, with growth on pace for its first full-year acceleration since 2010. Yet economists forecast a slowdown next year, and rising U.S. interest rates are set to complicate China’s deleveraging push. Xi’s biggest challenge next year is “sustaining popularity in the face of potential economic problems,” said Susan Shirk, chair of the 21st Century China Center at the University of California, San Diego. “I’m waiting to see what might trigger middle class opposition.” Other issues that risk stirring discontent among the middle class include polluted air, education quality and online censorship. Since Xi became one of China’s most powerful leaders ever in October, a series of social problems—from migrant evictions to poor villagers shivering without heat in the winter—showed how quickly things can go wrong. 2) Keep the Peace China embarked on a much more proactive foreign policy in 2017, seeking to mediate disputes between Afghanistan and Pakistan, Myanmar and Bangladesh, and even Israel and Palestine. Driven mainly by its expanding economic interests around the globe, China’s relative inexperience in conflict resolution gives it a chance to try some fresh approaches. Still, Xi’s biggest foreign policy headache is on his doorstep: North Korea. Kim Jong Un’s regime is getting ever closer to gaining the ability to strike the U.S. with a nuclear weapon—and Trump has threatened war to stop him. While China has responded to Trump’s pressure by tightening sanctions to unprecedented levels, it remains to be seen if Xi can stave off military action. 3) Keep Exploiting Asia’s Worries About Trump Trump’s focus on reducing trade deficits in Asia with friends and foes alike provided an opportunity for China to improve strained ties throughout the region. In 2017, China saw better relations with Myanmar, Singapore, Vietnam, and the Philippines—all nations that it had sparred with recently. Still, China risks overplaying its hand. Any economic coercion to achieve its geopolitical aims threatens to scuttle the recent goodwill. Reports say it’s again blocking group tours to South Korea due to a dispute over a U.S. missile shield. In 2018, China will be tempted to flex its economic muscle with Southeast Asia in a bid to water down a code of conduct in the South China Sea. 4) Keep a Cool Head China’s strategy of “strategic composure” in dealing with Trump’s tweets appeared to pay off. Dire predictions of a trade war failed to materialize, while Xi and Trump shared warm words in meetings in Florida, Hamburg and Beijing. This month, China had a measured response when Trump called China a “revisionist” power that is challenging U.S. influence around the globe. Next year might be dicier, with the North Korean threat growing and the U.S.’s trade deficit with China set to widen. One potential flashpoint is a U.S. investigation into China’s alleged intellectual property violations that could be used to justify punitive actions, including higher tariffs. 5) Keep Looking Like a Reformer Next year marks the 40th anniversary of economic reforms that put China on a path to becoming a global economic juggernaut. Xi already rolled out several big-bang measures at the start of his second term in late October, including relaxed limits on foreign ownership of banks and securities firms. Through much of his first five years in office, a debate raged over whether Xi was a market reformer or an economic nationalist. Now with unrivaled power, Xi is poised to show the world just how far he’ll go in opening up the world’s second-largest economy. “We may see reforms to make the state-led economy more efficient, but not necessarily more liberal,” said Trey McArver, co-founder of research firm Trivium China.