Added num-threads option to control the number of CPU threads