chapter 9 changes to cleanup node tree