add new code for thread service