modify thin.cpp and add comments