Moved in code from training app