Nearly seven months after voluntarily filing for bankruptcy protection, Ultra Petroleum Corp. said it has reached agreements to reorganize with majorities of its shareholders and creditors.

Houston-based Ultra said Tuesday it has entered into a plan support agreement (PSA) and a backstop commitment agreement (BCA) with creditors holding “a substantial majority” of the principal amount outstanding on its 5.75% senior notes due in 2018, and for 6.125% senior notes due in 2024. The company also said shareholders “who own at least a majority” of its outstanding common stock have also signed on to the agreements.

Ultra filed for Chapter 11 bankruptcy protection last April after months of negotiations with its creditors proved unsuccessful. The company filed in U.S. Bankruptcy Court for the Southern District of Texas [No. 16-32202].

According to an 8-K filed Tuesday with the U.S. Securities and Exchange Commission (SEC), the PSA calls for all allowable claims and interests in Ultra to be restructured. A rights offering is expected to raise $580 million in cash at an implied 20% discount to the total enterprise value of Ultra and its seven subsidiaries — UP Energy Corp., Ultra Resources Inc., Keystone Gas Gathering LLC, Ultra Wyoming Inc., Ultra Wyoming LGS LLC, UPL Pinedale LLC and UPL Three Rivers Holdings LLC.

Under the PSA, the total enterprise value of Ultra and its subsidiaries will range from $5.5 billion to $6.25 billion. Specifically, if the average closing price of the 12-month forward Henry Hub natural gas strip during the seven trading days preceding the commencement of the rights offering solicitation is greater than $3.65/MMBtu, the value will $6.25 billion. Conversely, if the price is less than $3.25/MMBtu, the value will be $5.5 billion.

Assuming Ultra is valued at $6 billion, each stockholder will receive a pro rata share of 41% of the reorganized company’s equity, as well as a pro rata share of rights to participate in the rights offering for 5.4% of the equity in Ultra. Meanwhile, the company’s noteholders will receive a pro rata share of 36.2% of the reorganized company’s equity and a pro rata share of rights to participate in the rights offering for 16.1% of the equity in Ultra. Both arrangements are subject to dilution by the company’s management.

Ultra told the SEC that the BCA calls for giving holding company noteholders and equity holders the right to subscribe for the rights offering in an amount up to their pro rata share of new common stock. Collectively, the shares held by noteholders will collectively reflect an aggregate purchase price of $435 million; for equity holders, the figure will be $145 million.

Upon closing of the rights offering, Ultra and its subsidiaries will pay its stakeholders a commitment premium equal to 6% of the aforementioned $580 million.

“These agreements reflect our commitment to maximizing the value of our estates for the benefit of all our stakeholders,” said CEO Michael Watford. “Even before we began our in-court reorganization, we have been steadfastly dedicated to preserving significant value for our shareholders, and entering into these agreements represents the next step in pursuit of that objective.

“We are very appreciative of the cooperation we received from our stakeholders and their recognition of the substantial value represented by our assets and hard-working employees and contractors.”

The 8-K did not indicate when the company plans to exit Chapter 11.

Ultra has an operations office in Denver and field offices in Pinedale, WY, and Vernal, UT. The company owned 151,000 net acres and 1,979 net producing wells at the end of 2015, with production for the year totaling 290 Bcfe and proved reserves of 2,528 Bcfe. It holds acreage in the Pinedale and Jonah fields in southwest Wyoming, the Three Rivers Formation in Utah, and the Marcellus Shale in Pennsylvania.