Refactoring of Rule and RuleSet API.