added training data and newer routine