Bank of America’s newly minted CEO Brian Moynihan was inches away from being booted by his predecessor Ken Lewis as the bank was gearing up to merge with Merrill Lynch, new documents show.

A little over a year ago, Lewis offered Moynihan the top spot at the company’s credit-card business. But the longtime BofA employee declined because he didn’t want to move his family to Delaware, said testimony posted by the Securities and Exchange Commission.