The United Nations body governing worldwide mail systems will remain intact after it agreed to a compromise on Wednesday that will change the way its postal fees are structured. The decision will keep the United States from leaving the group, which the Trump Administration had threatened to do — a move that many feared would create a chaotic situation of changing prices and mail disruption.

President Donald Trump announced last October that the U.S. would exit the Universal Postal Union (UPU) in one year if the group’s 192 members did not agree to reform the rates that countries charge each other when delivering mail and small packages across borders. His main complaint was that the system allowed countries such as China to pay heavily subsidized rates, thanks to a system meant to help developing countries, even though its economy has grown substantially since the system was put in place. As a result, it can sometimes be cheaper for companies in China to send merchandise to the U.S. than for domestic American manufacturers to mail similar items between states.

The pressure to achieve reform before the Oct. 17 deadline set by Trump created a situation that one industry executive told TIME earlier this month was “like Trump is having his own Brexit.”

But the new deal, reached after emergency talks at the group’s extraordinary congress in Geneva this week, means that particular shipping scramble can come to an end. The U.S. will get to set its own postal rates starting in July 2020 and other countries will be allowed to move toward setting their own fees in 2021, with a five-year period of phasing in new rates.

Representatives at the UPU summit eagerly applauded when “Option V” — the final compromise — passed on Wednesday. Bishar Hussein, the director general of the UPU, had warned on Tuesday that a U.S. withdrawal from the group could have dire consequences.

But after the consensus was reached, Hussein smiled broadly as he declared the union “stronger than ever before.”

Peter Navarro, the White House trade adviser, said in a call with reporters that the deal was a “huge victory” for American manufacturers and that the change in postal dues would save the U.S. between $300 and $500 million per year.

“This agreement will also transform an antiquated, discriminatory system into a modern, resilient one,” he said.

As part of the deal, the U.S. will also pay the postal union $40 million to help advance security measures against the shipping of drugs such as fentanyl and other illegal goods.

Business groups like the U.S. Chamber of Commerce, which supported reforming the postal union’s rates, were also happy with the outcome.

“The administration deserves a tremendous amount of credit for their leadership in tackling an antiquated, market distorting global pricing arrangement that for too long has seen the United States footing the bill to deliver the rest of world’s mail,” Sean Heather, the Chamber of Commerce’s senior vice president for International Regulatory Affairs, said in a statement.

Others had been worried that if the U.S. did pull out of the postal union, it could have meant disruptions in election mail, obstacles for military families abroad, or trouble in shipping ahead of the holiday season, as it could have forced mail sent from the U.S. to undergo increased customs scrutiny. Kate Muth, executive director of the International Mailers Advisory Group (IMAG), says the deal left her members, which include Amazon and eBay as well as bulk mail consolidators, breathing a sigh of relief.

“For our membership it’s kind of the best we could have hoped for,” Muth tells TIME. “To our members, it was very important that the United States stay in the UPU. So there was overwhelming relief and now we’re going to dig down into a better understanding of how the rate system will work as we transition to a new structure.”

However, the U.S. Postal Service still has to finalize what its rates will be under the new system, and other countries will make their decisions in the coming months as well. While much of the worry caused by the idea of a U.S. exit from the UPU has been avoided, some consumers will likely see costs rise, Hussein said.

“Once a country declares their rate, exporting countries will have to factor that cost, so it means that cost will be transferred to the person who is sending that item,” he said at a news conference on Wednesday. “When you are in a country and you buy items overseas, the end-customer will definitely have to pay a higher price.”

Write to Abigail Abrams at abigail.abrams@time.com.