Add option to specify nb of threads