anchor.diff:      let balance (filters : QueryFilters) (journal : Journal) =
           let filteredEntries = filterEntries filters journal
   
  -        // TODO: Can I get rid of the list comprehension?
  -        // filter entries based on selected accounts
  -        let entries = 
  -            [ for entry in filteredEntries do 
  -                for account in entry.AccountLineage do 
  -                    yield(account, fst entry.Amount) 
  -            ]
  -
           // sum to get account balances, discard accounts with 0 balance
           let accountBalances =
  -            entries
  -            |> Seq.ofList
  -            |> Seq.groupBy fst
  -            |> Seq.map (fun (account, amounts) ->
  -                let balance = 
  -                    amounts
  -                    |> Seq.map snd
  -                    |> Seq.sum
  -                (account, balance))
  +            filteredEntries
  +            |> calculateAccountbalances
               |> Seq.filter (fun (account, balance) -> balance <> 0M)
               |> Seq.toList
           
  
positive.code:             |> List.filter (fun entry -> (Set.contains entry.Account accounts) 
                                           && (withinPeriod entry.Header.Date filters.PeriodStart filters.PeriodEnd))
  
  
      open Support
  
  
negative.code:                 allBalances
                  |> List.exists (fun ((otherAccount : String), otherAmount) -> otherAccount.StartsWith(account) && otherAccount.Length > account.Length && otherAmount = amount)
                  |> not
              accountBalances
              |> List.filter (existsChildAccountWithSameAmount accountBalances)
  
  