Added pseudocode.