Bank of America Corp has reached an agreement with the U.S. government repay its $45 billion in bailout funds in the next few days, the company said on Wednesday.

The Charlotte, North Carolina-based banking giant is expected to sign the documents repaying its Troubled Asset Relief Program funds over the next few days.

The move comes as the bank has struggled in its ongoing CEO search to find a replacement for retiring Chief Executive Ken Lewis.

Analysts and bank observers have said the struggles stemmed in part from the $45 billion in government aid extended to the bank. The U.S. pay czar curbed the pay for top executives and introduced other restrictions.

Lewis, retiring at year's end, has repeatedly said his goal was to repay the funds before he left the company.

(Reporting by Joe Rauch, editing by Matthew Lewis)