implemented batching