improving the code of the rule 3.1 (like @arunisaac code)