refactored from threadpool to task