Works with rules from database