refactor
add save_thread_data