Changed for loop range to use threadcount instead of len(thread_pairs)