Completed part A of exercise 2