all steps of file-delete refactored (not yet tested)