why do you need thread_index parameter?