migrate code from StreamCorpusDexter to SCTools