Incorporated some called functions to the end of the training script.