Modify 1-29 and 1-31 to use local variables