Code for exercise 1 completed