Add implementation of exercise 9.6.9