A batching framework