rulesEngine refactoring