Adding the factory pattern.