Refactor file deletion into own method