cleanup code: batch_mode