can we reuse the value of `in_transaction` assigned above to save the second check?