updated psuedo code for progMatch.