Refratored and Solved Question 3