update factory pattern