refactoring method is_Valid_File