merged from chap 6