pseudocode modified