Change algorithm