Working on Question 2. Imported code from Question 5.