add batching functionality