Refactoring LedgerSource and LedgerSink