optimize factory