chapter2: diamond book; chap4: notes