adds factory pattern