Sort out string replacing