imported from chap9/