Revised the transaction handling