public static void main(String[] args) {

		//Usage check
		if (args.length != 3){
			System.err.println("Wrong number of arguments");
			System.err.println("Usage: listingsfile productfile outfile");
			return;
		}

		String listingsFile = args[0];
		String productfile = args[1];
		String outfile = args[2];

		System.out.println("Gathering listings..");
		Listing[] allListings = null;
		try{
			allListings = FileIn.getListings(listingsFile);
		}catch (JsonSyntaxException jsonException){
			System.err.println("Error parsing " + listingsFile);
			return;
		} catch (IOException exception){
			System.err.println("Error reading " + listingsFile);
			return;
		}

		System.out.println("Gathering products..");
		Product[] allProducts = null;
		try{
			allProducts = FileIn.getProducts(productfile);
		}catch (JsonSyntaxException jsonException){
			System.err.println("Error parsing " + productfile);
			return;
		}catch (IOException exception){
			System.err.println("Error reading " + productfile);
			return;
		}

		System.out.println("Calculating results..");
		Algorithm algoritm = new WeightedTermsAlgorithmm();
		Set<Result> results = algoritm.getAllResults(allListings, allProducts);

		System.out.println("Saving results..");
		try{
			FileOut.saveResults(outfile, results, false);
		}catch (IOException exception){
			System.err.println("Error writing to " + outfile);
			return;
		}
	}