Added comments and defaulted $ledger_id to null