Added pseudocode