More work on rewrite.