Saudi King Salman’s ongoing visit to Asia, through which he hopes to attract Japanese and Chinese investment in Saudi Arabia, is another indication of how committed the country is to reforming its economy. This trip, along with a host of fiscal modifications at home and the impending initial public offering (IPO) of Saudi Aramco, the country’s national petroleum and natural gas company, underscore the Kingdom’s recognition of its need to escape dependence on oil—a realization that has come as a result of failed policies from 2014 to 2016 that forced Riyadh to accept the fact that its days of dominating oil markets are over.

Saudi Arabia’s strategy during the production war was to let the spigots flow in the hopes that doing so would undermine two other producers: Iran and the United States. Iran had always enjoyed a latent ability to wrest market control from Saudi Arabia, but crippling international sanctions prevented it from doing so. After the nuclear deal, though, the threat to the Kingdom increased. At the same time, the U.S. oil industry presented a new challenge. By 2015, after a decade of technological innovations, including the use of wireless seismological testing and the automating of various oilrig functions, it had claimed the mantle of global production leader from Saudi Arabia.

In the face of eroding market share, Riyadh refused to cut oil production. It instead opted to increase output in 2016—setting new records for its production levels—to keep global supply high and prices down. In so doing, Riyadh wagered that it could survive depressed prices with its over half a trillion dollars in foreign exchange reserves, while its U.S. and Iranian competitors would in turn face so much financial pressure that they would bow out of the running. This was a marked divergence from past Saudi strategy, which typically favored cutting production to regulate supply and keep prices elevated.

The Kingdom’s production war was costly. The resultant oil price slump hurt Saudi finances; between 2014 and 2016, Saudi reserves fell from $746 billion to $536 billion—a pace that would have completely emptied the Kingdom’s coffers in half a decade. The drop in oil revenues, combined with the costs of a war in Yemen and a generous system of subsidies and low taxes, resulted in an unsustainable situation. So it surprised no one when Riyadh declared a cease-fire to its oil war last year, agreeing with other OPEC members to cut production.

Saudi overproduction might have been worth it if it had knocked out Iran or the United States, but instead, Saudi Arabia was the main victim. Given how severe the sanctions on Iran had been, Iran was bound to benefit from any oil exports, no matter how low oil prices became. And despite the toll of low prices on U.S. shale oil producers, those producers continued to have a competitive advantage because of their state-of-the-art extraction technology. If anything, the pressure of low prices pushed U.S. producers to focus even more intently on cost-cutting, automation, and increasing overall efficiency to lower the breakeven price.

Saudi overproduction might have been worth it if it had knocked out Iran or the United States, but instead, Saudi Arabia was the main victim.

U.S. producers are far ahead of their peers in much of the world, Saudi Arabia included. This is because for some time, U.S. experts have been developing new technologies so that U.S. producers can get more oil out of their operations abroad. Those experts have now turned their technologies inward. The U.S. has become one of the epicenters of technological innovation in horizontal drilling and fracturing. This is why Saudi Aramco has established a research center in Houston to explore the usage of unconventional oil and gas production.

Saudi Arabia is, of course, not so lucky. Its growth is slowing and its ratio of debt to economic output is increasing. For these reasons, Saudi Arabia’s cost of borrowing is rising; Fitch, Standard & Poors, and Moody’s all lowered the country’s credit rating in 2016. As a result of its financial difficulties, Saudi Arabia has since sought to shore up its economy in various ways. One unprecedented measure is the public listing of five percent of Saudi Aramco—which will occur next year and will likely be the biggest IPO in history. On his trip to Asia, Salman is seeking to attract investors for the IPO, and the Hong Kong Exchanges and Clearing is vying to host the event. Hong Kong, given its connection to Chinese markets, would serve as a bridge between Saudi Aramco and the deep pockets of mainland Chinese investors.

Fiscal reforms at home are equally unprecedented. They include increasing excise taxes and visa fees for expats, cutting subsidies to water and energy products, and reducing the number of public works projects in the transport, housing, and health-care sectors. And perhaps most fantastically of all, Saudi Arabia has a plan to switch from the 354-day Islamic lunar calendar to the 365-day Western Gregorian calendar, allowing the government to squeeze 11 more work days out of employees without increasing annual salaries.

Even before oil prices took a dive, Saudi Arabia had already been aware that in the not-so-distant future, it would need to get its financial house in order and diversify economically. That is why it had pushed to develop new non-oil sectors, such as renewable energy and even dairy farming. Until recently, it was moving at a decidedly lackadaisical pace, but what the oil war showed is that slow change is no longer an option.