BLOCKER: Issue 487

Note that this PR touches all code that deals with files and is ready for review.