added variable replace code