refactors ledger and transaction