Test rewrite rules
Repair cost encoding mechanism to enable better data-independent rewrite rules