Atlanta-based SunTrust Banks reported on Friday improved profit in the second quarter, as revenue grew and costs related to bad loans continued to moderate.

SunTrust grew mortgage revenue from new home loans as well as refinancing by borrowers taking advantage of historically low interest rates. SunTrust also has seen a lift from a federal aid program allowing refinances for borrowers who owe more than their houses are worth.

SunTrust remains dogged, however, by soured mortgage loans made during the boom that investors — including government-backed Fannie Mae — are now demanding SunTrust buy back.

Mortgage repurchase demands were $489 million in the second quarter, up $41 million from the first quarter and $141 million from the second quarter 2011. Aleem Gillani, SunTrust's chief financial officer, said the bank expects demands to remain high and variable, but that the hit to the balance sheet should decline at the end of the year.

"The farther we move away from those truly toxic years in the housing market, the losses and severity will come down," said Terry McEvoy, bank analyst with Oppenheimer & Co.

SunTrust reported net income to common shareholders of $270 million, or 50 cents per share, compared with $174 million, or 33 cents per share, in the second quarter of 2011. Analysts had expected earnings of about 44 cents per share.

Revenue grew 2 percent to $2.24 billion as interest income also climbed. Total loans grew 8.4 percent to $124.5 billion, led by a 12 percent gain in commercial and industrial loans.

Net charge-offs of bad loans dropped 31 percent compared with the second quarter a year ago. New problem loans also declined, and the bank continued its trend of setting aside less money to cover bad loans.

SunTrust also said it is more than 80 percent of the way toward achieving $300 million in annual savings under a cost-cutting program. That program includes cutting discretionary spending, shuffling branch staffing, and making job cuts, among other things.

Expenses were roughly flat for the quarter, however, reflecting higher commission compensation and some non-recurring charges.