Adding code for exercise 2