Added some assert_thread()s and comments.