cleaning the branch tree up