Refactor Threadpool class

Part of #4 issue.
Done.