ch3 - adjusted pseudo-code 2