the exercise code from the book,with annotation