added code for chapter13 and chapter21