Code rewritten. Replacing string