Made changes based on Intellij's suggestions, including changing e.g. new LinkedList<String> to new LinkedList<> and no longer ignoring the result of file.delete