Previously when rewriting specific template files they were not overwritten properly. This commit updates the behaviour to use the right os.Open flags.
This commit moves a huge chunk of the code to go. The TODO.md document indicates what is left to be done.