Solution for Part B