4.1:  updated pseudocode