Adding product file contents replacement logic

* Renaming replace_contents to replace_r