Added code for Exercise A.a and A.b