I re-wrote the term re-writing system and wrote a few test cases for
it.