Enhancement/thread pool refactoring