HSBC has reported a rise in its first half profits and announced a share buyback as it prepares to ring-fence its UK retail arm by 2019.
Europe's biggest bank reported a 5% rise in pre-tax profit of $10.2bn (£7.8bn) for the first six months of 2017, up by about $500m.
As widely expected, the bank has also announced a share buyback of up to $2bn which it expects to complete by the end of 2017.
HSBC shares rose 3% on the news.
The bank's shares fell back later but its share price has rallied over the past year, helped by the weak pound which makes profits earned abroad more valuable when repatriated to the UK.
Since the 2008 financial crisis, HSBC has been cutting jobs and selling assets to make the group more profitable, while still making dividend payments to shareholders.
"In the past 12 months, we have paid more in dividends than any other European or American bank and returned $3.5bn to shareholders through share buybacks," HSBC's chief executive Stuart Gulliver said.
The bank has used share buybacks to offset the impact of shares being paid out as dividends.
The announcement takes the total of HSBC share buybacks since the second half of 2016 to $5.5bn.
Analysis: Dominic O'Connell, BBC Today business presenter
While HSBC's headline numbers slightly beat expectations, the fine print shows how banks are still feeling the fallout from the financial crisis nearly a decade ago, and in unexpected ways.
There is the list of pending litigation from investors who feel cheated, a long series of continuing investigations from US and UK authorities - and the huge cost of meeting new financial regulations.
In the UK, the biggest has been the "ring-fence" - the plan to have retail and investment banking operations separated by 2019.
HSBC said the process of untangling the two (and setting up a new Birmingham headquarters for the retail arm) had already cost it nearly £400m. At its height, the project employed 2,000 people, according to HSBC chairman Douglas Flint - about 800 more than are employed at HM Treasury.
"Like many of the other banks, HSBC has beaten modest expectations," said Peter Hahn of the London Institute of Banking and Finance.
HSBC said it had spent about $500m on splitting its retail from its investment banking arm, which it described as "one of the largest projects ever undertaken by the group". The bank's new Birmingham headquarters for its UK retail business will begin operating in July 2018.
"The ring-fence is a big expense creating lots of uncertainty," said Mr Hahn. "It's not just the headquarters, it's separating lots of the systems in the bank."
HSBC said it took a charge of £228m ($300m) during this reporting period for PPI claims, primarily reflecting a recent increase in complaint volumes. It has set aside £3.3bn to date to deal with the claims relating to mis-sold mortgage payment protection, a matter that is casting a long shadow over the balance sheets of UK banks.
Last week Lloyds and Barclays both said they were setting aside another £700m to cover the cost of compensating customers over insurance mis-selling.