Batch Sampling added with some errors.