Generic handler for batches