add thread code to visualizer