A U.S. Bankruptcy Court has approved NPC International’s $801 million sale of more than 1,300 Pizza Hut and Wendy’s stores to Flynn Restaurant Group and Wendy’s.

The move comes more than six months after NPC filed for bankruptcy. As part of the agreement, Flynn—the largest restaurant franchisee in the U.S.—will take over roughly 950 Pizza Hut and almost 200 Wendy’s restaurants for a price tag of $552.6 million. Wendy’s franchisees will take 200 of NPC’s other Wendy’s locations for approximately $248.3 million.

The sale is expected to be completed by the second quarter. Flynn already operates Applebee’s, Panera, Taco Bell, and Arby’s restaurants. When Pizza Hut and Wendy’s join the fold, the operator’s footprint will cover more than 2,500 stores.

Pizza Hut Division CEO Artie Starrs said Flynn’s near-term plans include modernization of a significant portion of the acquired restaurants while improving operations.

In its bankruptcy filing, NPC attributed much of its situation to Pizza Hut experiencing a strain on profitability due to stagnant sales growth, loss of market share, reduced traffic, and other pressures. Prior to the deal, NPC operated roughly 1,200 Pizza Huts, but the franchisee worked with the pizza chain to close several hundred stores—most of which were dine-in. The move supported Pizza Hut’s ongoing strategy to shift to off-premises.

Starrs said he’s confident that Flynn will continue that push.

“The agreement with Flynn Restaurant Group advances Pizza Hut’s transformation strategy focused on modern, delivery and carryout restaurants and outstanding customer experience, while preserving thousands of jobs,” Starrs said in a statement. “Flynn is an existing Yum! Brands franchisee for Taco Bell that is well-capitalized, growth oriented and brings a strong track record of operational excellence. We are confident that Flynn’s ownership of these restaurants will make the entire Pizza Hut U.S. system stronger and we welcome Greg Flynn and his team to the Pizza Hut family.”

While NPC, Flynn, and Pizza Hut came to an agreement early in the process, Wendy’s and Flynn took a longer road toward resolution.

Originally, Flynn was designated the stalking horse bidder as part of an $816 million purchase agreement. Wendy’s chose not to give consent because of Flynn’s breakup fee, or funds that would be owed to the franchisee if it didn’t win the bid, as well as its ownership of Arby’s and Panera, which are competitors, according to the fast-food chain. Wendy’s and Flynn also couldn’t reach a final agreement on personal guarantees, reimaging and development obligations, store count limitations, or maximum leverage requirements.

Flynn called the issues solvable, but also argued that Wendy’s has allowed other franchisees to operate Arby’s and Panera units and noted more than 363 of NPC’s franchise agreements don’t name Arby’s or Panera as competitors. In addition, the franchisee agreed to invest significant capital in both brands.

Three auctions were scheduled for the Wendy’s assets, Pizza Hut assets, and combined assets, but were later canceled. According to Bloomberg, an NPC lawyer said the auctions were canceled because offers were too low. This cleared the way for Flynn to complete its deal.

After an impasse, Flynn and Wendy’s entered mediation and decided to split the Wendy’s restaurants.

Fast Food, Finance, Story, Pizza Hut, Wendy's