changed number of threads parameter