modified the rulegroup codes