First version for the training set generation