Adding threadPool functionality