Refactored from Threadpool to task