Add ndg ch04 code