Implementation for Question 8