New threadpool class to make multithreading much simpler. Adjusted the multithreading in the matching appropriately.

Change-Id: Iea89cb5c53cd36c0c83e47095c2a1dafaf8cce9a