building the account tree