exchange pseudocode