Added setRules method.
Merge branch '4.0'