start refactoring so that the whole transaction can be rolled back if
there are failures