refactor the tree of ECMS