Moved addClassToTrainDataset outside of for loop.