doc and refine codes update for thread