Rough pseudocode in place for P7