Added the ability to rollback changes
Incorporated rollback logic if the there is a problem writing to a file
Enforce the filemode
Incorporated rollback logic