Updated templates and implemented the `replacestream`