added batch_size option to limit the number of items to be assigned at once