Wrote a little pseudocode for write.TextGrid.