Image source: Getty Images.

What: Healthways (TVTY) ended the day up 30% after announcing plans to sell its Total Population Health Services and two Emerging Solutions businesses to privately held ShareCare, which was founded by TV personality Dr. Oz.

So what: The deal allows Healthways to shed its unprofitable population health business that works with companies and health insurers to improve the health of their employees and members.

In a rather complicated deal, Healthways is giving ShareCare $25 million to cover the losses expected from the acquired businesses, and will get $30 million worth of ShareCare's stock. While it looks like Healthways is essentially selling the businesses for $5 million, it's technically more complicated than that because ShareCare is a private company, and the $30 million of stock is based on the valuation at its last fundraising round. If ShareCare is actually worth more when the deal closes than it was when it last raised capital, Healthways is actually selling the company for more than $5 million.

It gets even more complicated. If the businesses lose more than $25 million on a cash-flow basis during the first 12 months after the deal closes, Healthways agreed to cover the additional cost by forgoing up to $20 million of the $30 million in stock it's supposed to receive on a dollar-for-dollar basis.

Now what: Healthways is holding onto its network solutions business, which includes Silver Sneakers Fitness, Prime Fitness, and Physical Medicine. After the restructuring, Healthways believes the exercise programs will bring in greater than $500 million in earnings before interest, taxes, depreciation and amortization (EBITDA) margins of more than 20%. This sounds a lot better than the 6% EBITDA margin it posted in the first quarter.