switch to using a thread pool