Changes to batching logic

Changes to batching logic