Moved server response code into ThreadWorker class.