Given the current oil boom, it's hard to believe that there could be petroleum pipeline companies losing money. That's exactly what NuStar Energy (NYSE:NS) has been doing, though. The company is making big changes, however, and it could develop into a lucrative turnaround play.

NuStar Energy is a master limited partnership (MLP) with over 8,600 miles of pipeline and 84 terminal and storage facilities. It transports and stores crude oil, refined products, and specialty liquids, and has about 92 million barrels of storage capacity. The company operates mainly in the United States, but is also active in Canada, Mexico, the Netherlands, the Caribbean, the United Kingdom, and Turkey.

The company's corporate general partner is NuStar GP Holdings (NYSE:NSH), which holds a 2% general partner interest, a 13% limited partner interest, and 100% of the incentive distribution rights in NuStar Energy. Founded in 2000, NuStar is based in San Antonio, TX.

Impaired performance
For a variety of reasons, NuStar Energy has been shedding value for a while now. At the end of 2012, the partners' equity was $2.58 billion, but dropped by more than 26% in 2013 to $1.90 billion.

One big hit to earnings has been goodwill impairment charges. Goodwill is the excess over book value that an acquiring company pays for assets, usually other companies or portions thereof. This goodwill essentially represents intangible things like brand awareness or synergies that may exist in such assets. These can be fleeting, however, and their value can often decrease or disappear altogether. When that happens, companies must report the impairment of goodwill as an expense.

That's what NuStar has been doing. In 2012, the company had an impairment charge of $266.4 million related to an asphalt operation which it later sold. In 2013, NuStar took another impairment hit of $304.5 million on two of its terminal operations. As of the end of March, the company still carries over $617 million of goodwill, a warning sign given its past actions.

Courtesy NuStar Energy

Another possible concern is NuStar's heavy reliance on Valero Energy (NYSE:VLO) as a customer. Valero is the largest customer for its storage business, accounting for about 18% of the segment's revenue in 2013. However, NuStar reported that no other customer accounted for more than 10% of the storage revenues. Over 3,000 miles of NuStar's 8,600-mile pipeline network also depends on Valero. The company's Central West system originates at Valero's McKee, Three Rivers, and Corpus Christi refineries, gathering refined products for further distribution.

Signs of improvement
NuStar's performance in the quarter ended March 31, 2014 was encouraging. Although revenue dropped about 15% from the same quarter a year ago, that's most likely due to the divestiture of the money-losing asphalt business. Margins improved, and both operating income and net income increased.

Oddly, even though the company made a profit, partners' equity continued to shrink, this time dropping to about $1.84 billion. This was predominantly due to the distribution payment to the limited partners, which for an MLP is treated as a return of capital. Basically, the company isn't completely covering its distributions with distributable cash flow, which is a warning sign for MLP investors.

Courtesy NuStar Energy

However, NuStar is addressing these issues. The above graphic points out how the company is concentrating on its core business segments, leading to EBITDA growth. NuStar is now planning to move away from volatile margin-based businesses and toward more stable fee-based pipeline and storage operations, as exemplified by the sale of its stake in the asphalt company. According to a recent company presentation, it is on track to achieve a distribution coverage ratio of 1.0 in the last two quarters of 2014, as well as for the entire year.

Should Fools rush in?
The market apparently applauds NuStar's efforts. After a long decline ending in 2013, the prices of both NuStar Energy and NuStar GP Holdings have recovered.

Earnings are due out at the end of July, and investors should look for positive revenue growth this time in addition to continued progress on margins and earnings. They should also keep an eye on that overhanging goodwill in the balance sheet.

This one isn't for the faint of heart, but aggressive investors looking for high current yield, tax advantages, and estate planning benefits may want to consider NuStar Energy as a potential turnaround play. Investors who don't want to deal with the tax complexities of MLPs can take a position in NuStar GP Holdings instead.