allow for number of threads to be specified