API refactoring: separand handles for the rules and head