Rule engine support

Added the support for the new Rule Engine. The support for the old rule system still exists.