batches of 50 for constant memory.