API refactoring: separate handles for the rules and head
Merge pull request #180 from mdevaev/master

API refactoring: separated handles for the rules and head