Refactor rule structure.