Adding annotated answer for problem 3