Added string replacement code