added transaction handling code