Improved logging.
Add safe_complete method and use it everywhere.

Also contains general cleanup/consistency fixes.
Fixes object upload, improves download handling.