use thread instead of go