Added extra exception code.
Skipping chmod when current user and group running the script is the same as the desired user/group for chmod.
Added extra debug logging