Hopefully correct logic for merging batches....