add minimization code