2nd try at infrastructure for optimizer.