NEW YORK (AP) ¿ Shares of Healthcare Realty Trust Inc. rose Wednesday after an analyst upgraded the stock due to strong second-quarter results and the company's refinancing plan. Morgan Keegan analyst Robert Mains raised his rating to "Outperform" from "Market Perform." He cited Healthcare Realty Trust's funds from operations in the second quarter, and said the company is refinancing its credit facility at a lower cost than he expected. Those two factors make the stock undervalued compared to equity and health care real estate investment trusts, he said. Shares of the Nashville, Tenn., company added 94 cents, or 4.5 percent, to $21.90 in midday trading. Monday afternoon, Healthcare Realty Trust said funds from operations in the second quarter totaled 44 cents per share, well ahead of the 38 cents per share analysts were expecting. Funds from operations is a measurement of real estate operating performance that adds items like depreciation and amortization back to net income. "The key driver was considerably better managed properties net operating income as revenues and margins were both higher than we had expected," Mains said. He said he had been uncertain about the terms of the company's refinancing.