update for factory pattern