added transaction logic