copied Trajectory and Unigram code I modified, from CompleteRun2 (after recovery)