extract threadpool out into a module. output format fixing