Part C and D outputs are not working as expected.