anchor.diff:          |> List.fold buildParentAccountAmounts Map.empty
           |> Map.toSeq
           |> Seq.map (fun (account, amounts) ->
  -            let real = SymbolAmountMap.toSortedAmountList amounts.Real
  -            let basis = 
  -                match Map.isEmpty amounts.Basis with
  -                | true  -> None
  -                | false -> Some <| SymbolAmountMap.toSortedAmountList amounts.Basis
  +            let real, basis = RealAndBasisAmounts.toSortedAmountLists amounts
               {
                   Account = account;
                   Balance = real;
  
positive.code:     let calculateParentAccountBalances (accountBalances : AccountBalance List) : AccountBalance list =
          let addBalancesForParentAccount (accountBalance : AccountBalance) (parentAccountBalances : AccountRealAndBasisAmountsMap) (account : Account) =
              let updatedParentAmounts =
                  match Map.tryFind account parentAccountBalances with
                  | Some parentAccountAmounts ->
                      let realBalances = List.fold SymbolAmountMap.add parentAccountAmounts.Real accountBalance.Balance
                      let basisBalances =
                          match accountBalance.Basis with
                          | Some basis -> List.fold SymbolAmountMap.add parentAccountAmounts.Basis basis
                          | None       -> parentAccountAmounts.Basis
                      { parentAccountAmounts with Real = realBalances; Basis = basisBalances }
                  | None ->
                      let balances = List.fold SymbolAmountMap.add Map.empty accountBalance.Balance
                      let basisBalances =
                          match accountBalance.Basis with
                          | Some basis -> List.fold SymbolAmountMap.add Map.empty basis
                          | None       -> Map.empty
                      { Real = balances; Basis = basisBalances; }
              Map.add account updatedParentAmounts parentAccountBalances
  
          let buildParentAccountAmounts (parentAccountBalances : AccountRealAndBasisAmountsMap) (accountBalance: AccountBalance) =
  
negative.code: 
      /// Calculate total balance (sum of all account balances)
      let calculateTotalBalance (accountBalances : AccountBalance List) : AccountBalance =
          let real, basis =
              accountBalances
              |> List.fold RealAndBasisAmounts.addAccountBalanceBalances { Real = Map.empty; Basis = Map.empty }
              |> RealAndBasisAmounts.toSortedAmountLists
  
          {
              Account = "";
  