First stab at a fix.
Fix all known issues.
Add some documentation. Break some code out to its own function.
Ensure parent directories has the right perms.
Remove unlink protection from hpss since we need to do it for now. Will add it back later.
Merge head back in.