implemented part A of step 3