@SuppressWarnings("serial")
	public static boolean save(File filepath){
		try{
			if(filepath.exists()){
				if(!Main.notifyOverwrite(filepath.getName())){
					throw new UserException("User canceled overwrite"){};
					}
				filepath.renameTo(new File(filepath.toString() + "_OLD"));
				filepath.createNewFile();
				} else {filepath.createNewFile();}
			
			if(!filepath.canWrite()){Main.writeError("No write permissions"); throw new UserException("Unable to write"){};}
			FileWriter output = new FileWriter(filepath);
			Main.saveNoteString();
			output.write("<?xml version=\""+"1.0"+"\" "+"encoding=\""+output.getEncoding()+"\"?>");
			output.write("<beginSave version=\""+saveV+"\" patch=\""+patch+"\" >");
				output.write("<data>");
					output.write("<totalDays>"+Main.dayButtons.getDay()+"</totalDays>");
					output.write("<players>");
						output.write(parse(Main.playerArea.origString));
					output.write("</players>");
					output.write("<roles>");
						output.write(parse(Main.roleList.origString));
					output.write("</roles>");
					output.write("<generalNotes>");
						output.write(parse(Main.secondaryListener.genNoteArea.getText()));
					output.write("</generalNotes>");
				output.write("</data>");
				for(int x = 1; x <= Main.dayButtons.getDay(); x++){
					output.write("<number day=\""+Integer.toString(x)+"\" >");
						output.write("<day>");
							output.write("<notes>"+parse(Main.dayButtons.getDayString(x))+"</notes>");
						output.write("</day>");
						output.write("<night>");
							output.write("<notes>"+parse(Main.dayButtons.getNightString(x))+"</notes>");
						output.write("</night>");
						output.write("<whispers>");
							output.write(parse(Main.dayButtons.getWhisperString(x)));
						output.write("</whispers>");
					output.write("</number>");
				}
			output.write("</beginSave>");
			output.close();
			Main.frame.setTitle(Main.title + " - " + Main.fc.getSelectedFile().getName().split(".FMNT")[0]);
			if(new File(filepath.toString() + "_OLD").exists()){new File(filepath.toString() + "_OLD").delete();}
			return true;
		} catch (IOException e){
			Main.writeError("IOException");
			if(filepath.exists()){filepath.delete();}
			new File(filepath.toString() + "_OLD").renameTo(filepath);
			return false;
		} catch (UserException e){
			System.out.println(e.getMessage());
			return false;
		}
	}