implement steps 5A, 5B and parts of 5C