Rules rewrite changes.

Changes for the rules rewrite.