Added Eric Trautman's check for number of threads to prevent