pseudocode for 1.4