about to merge back with master. added ability to accommodate empty ledgers