updated transaction logic