build_dataset can be splitted among several threads