API refactoring: separate handles for the rules and head