Added the codes for exercise 6.3