add html segment ,optimize code structure