exercise 1-7, also used for 1-6