Changed minimize to work with new affine data structure