Add replacement logic