update optimization code