added function for extracting training set