Created ThreadPool to simplify parallel code