basic implementation of exercise 2.74