add suport for optimizing from warehouse