added ability to pass template file to use
fixed merge conflict