Adding changes from chp7 exercises