exercise 5.3 incorporating else