Some additions for batch training.