Cleaned up ``print_thread`` code.