Updated directory permissions to create the dir at 0755 instead of 0644.
Added umask while creating directories.
Changed umask to 0022.
Changed tmpStr to removedStr on line 226.
Added chmod to the exception for makedirs.  If the dir already exists, then chmod it to ensure proper perms.
Improved error handling when trying to remove a non-existent directory.