Implementing Exercise A.