ThreadPool refactor