initial pass at template mirroring script
clean up main path, move err handling to functions
Merge pull request #1070 from control-center/feature/CC-119

initial pass at template mirroring script