Rename main_thread to main_thread_id and simplify