Adding restrictions and fix bug where same rule name appears in one single rule
Code refactoring and more test samples