added validation and testing: chapter 7