added replace and replace_all functionality