update thread index and write comment