Final codes combined all function of psmctree and updatetree, add option function