Improve batch handling