Added string replacement code

The code is originally borrowed from new geometry rendering code