Basic thread pool. Some calculation issues are present