Refactoring file removing code