Updates to training and test functions.