[OPTIQ-382] Refactoring rules to use factories