Better logic for not starting too many threads.