Added CachedFactorizer and appropriate tests