Move transaction start to beginning of loop, so the rollback removes c/b's