Added batching code.