partial chapter 2 exercises, up to exercise 6