added function to read in training data