Improve method name
Add/modify some comments
Add test for writing an invalid manifest over a valid one
Fix bug in the tmp directory code.