private void saveHighScores(TreeMap<Integer, String> scoreMap, int scoresPerCategory) throws IOException {
		String filename = getHighScoreFileName(scoresPerCategory);	
		FileWriter writer = new FileWriter(filename);
		int mapSize = scoreMap.size();
		for(int entry=0; entry < Math.min(MAX_ENTRIES, mapSize); entry++) {
			Entry<Integer, String> mapEntry = scoreMap.pollLastEntry();
			writer.write(mapEntry.getKey() + " " + mapEntry.getValue() + "\n");
		}
		writer.close();
	}