Renamed resources to templates.  Fixed minor issue with empty prefix
Improved robustness of mkdir function by catching specific error when directory exists
Minor formating/spacing changes