Remove useless return
Add checks for stashes permissions and file type
Add code comment
Avoid useless directory creation