TODO: Improve batch sampling.