Added batching to the thereads