add code for example 1 in chapter5!