refact the code on hairui branch
test ok