private static boolean updateFile(String folder, String filename, String contents) throws IOException {
		if(!folder.endsWith(File.separator))
			folder = folder + File.separator;
		File location = new File(folder);
		if(!location.exists()) {
			System.err.println("Folder does not exist: " + folder );
			return false;
		}
		if(!location.isDirectory()) {
			System.err.println("Folder does not exist, this appears to be a file: " + folder );
			return false;
		}
		if(!location.canWrite()) {
			System.err.println("Permission on folder not set correctly: " + folder);
			return false;
		}

		File file = new File(folder + filename);
		if(file.isDirectory()) {
			System.err.println("Attempting to treat a directory like a text file: " + file);
			return false;
		}

		if(!file.exists()) {
			try {
				PrintWriter pw = new PrintWriter(folder + filename);
				pw.append(contents);
				pw.close();
				return true;
			} catch (IOException e) {
				System.out.println(e.getMessage());
				return false;
			}
		} else {
			String original = loadFileAsText(folder + filename);
			if(!original.equals(contents)) {
				System.out.println("File already exists and needs updating: " + file);
				PrintWriter pw = new PrintWriter(folder + filename);
				pw.append(contents);
				pw.close();
				return true;
			}
		}

		return false;
	}