Add a function that batches before performing some operation