improved the rules in rex file