Use thread pool to increase efficiency.