Improved the rules utils class with a factory.