Several improvements. RuleItem sorting