Refactor file writing - introduce template driven file writing

No match.