Somewhat faster: don't write until all sequences found.