CardRules module refactoring