Bank of America (BAC) trimmed roughly 151,000 loans from its portfolio of delinquent and discontinued mortgages in the second quarter through foreclosure or short sales. However, there are still millions of these loans to go. In February, BofA formed a Legacy Asset Servicing unit to handle loss-mitigation responsibilities along with representation and warranty claims. At the end of the second quarter, BofA reported more than 4.3 million loans in this portfolio, down 3.3% from the previous quarter. The amount of mortgages in 60-day delinquency or worse declined 5% to 1.2 million. "As you monitor the progress in this business, we continue to work down the number of loans and reduce the number of delinquent loans. We made very good progress during the quarter," said Chief Financial Officer Bruce Thompson. However, this work did come with increased costs. Noninterest expense for the new unit totaled $1.9 billion, up $402 million from the previous quarter. Thompson said most of the higher costs came from an increase in staff. As for the rep and warranty work, the $8.5 billion settlement with a group of investors in June dragged down earnings in the second quarter. The bank also set aside $5.4 billion in additional reserves for other nonagency securities and  possible future settlements with the government-sponsored enterprises. BofA shed more loans and properties already taken through foreclosure. In the second quarter, these loans totaled $17.9 billion, down from $19.5 billion last year and $18.4 billon in the previous quarter. The banking giant froze the foreclosure process in all 50 states last year to correct mishandled documents. The bank said restarted foreclosures — principally in nonjudicial states — helped reduce the backlog. However, the bank did not immediately comment on the status of judicial foreclosures. Write to Jon Prior. Follow him on Twitter @JonAPrior.