refactored markCompletedOutTransactions to use the immutable version + more tests