Chapter 7 - added validation