Add check_thread_safety and reformat code