public boolean writeFile(String filename) {
		List<String> categories = this.reader.getTags();
		
		try {
			FileWriter writer = new FileWriter(new File("./data/results/" + filename + ".txt"));
			BufferedWriter bw = new BufferedWriter(writer);

			for (int i = 0; i < this.results.size(); i++) {
				int j = 0;
				String resultString = "";
				int[] userResults = this.results.get(i);
				UserData userData = this.reader.getUserLines().get(i);
				List<Integer> userCats = userData.getTags();
				
				resultString += (this.reader.getUsers().get(userData.getUserID()) +
						(userData.getWikiID() == -1 ? "" : "-" + this.reader.getResources().get(userData.getWikiID())) + "|");
				for (int c : userCats) {
					//if (j++ < OUTPUT_LIMIT) {
						//resultString += (categories.get(c) + ", ");
						resultString += (c + ", ");
					//} else {
					//	break;
					//}
				}
				if (userCats.size() > 0) {
					resultString = resultString.substring(0, resultString.length() - 2);
				}
				resultString += "|";
				
				j = 0;
				for (int c : userResults) {
					if (j++ < OUTPUT_LIMIT) {
						//resultString += (categories.get(c) + ", ");
						resultString += (c + ", ");
					} else {
						break;
					}
				}
				if (userResults.length > 0) {
					resultString = resultString.substring(0, resultString.length() - 2);
				}
				resultString += "\n";
		
				bw.write(resultString);
			}
			
			bw.flush();
			bw.close();
			return true;
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		return false;
	}