add the code to handle transactions