Replaced for loops with create_batch.