Allow user to specify number of threads