chapter 9 changes to refactor nodes into their own classes