Updating exercise 1.29 after viewing Bill the Lizard's answer.