boolean isValidFile(File file) {
        if (!file.exists()) {
            System.err.println("Directory doesn't exist: " + file.getAbsolutePath());
            return false;
        } else if (!file.isFile()) {
            System.err.println(file.getAbsolutePath() + " is not a file");
            return false;
        }
        return true;
    }