Improve the replace technique