Initial commit from codes in Chapters 2 and 3