finished adding TP pseudocode