write psuedocode for extensible version