Add codes for exercise 2.2