speeding up mergeBatches - still buggy