add chapter3,4 code from Hanbit