ch3 - adjusted pseudo-code 3