adding the pseudocode