Ledger cleanup

Remove a number of `static` functions used to calculate indices from `Ledger` and make them free.