Lots of cleanup and changes to corpus.R functions, especially to documentation and to examples.