static public List<List<String>> readQueries(File query) {
		System.out.println("Reading queries...");
		Map<Integer,List<String>> queries = new HashMap<Integer,List<String>>();
		
		StringBuffer queryString = new StringBuffer();
		try {
			BufferedReader reader = new BufferedReader(new FileReader(query));
			String currentline = null;
	        while ((currentline = reader.readLine()) != null) {
	        	//skip comments
	        	if(currentline.startsWith("#") || currentline.isEmpty())
	        		continue;
	        	//store a finished query string
	        	if(currentline.toLowerCase().startsWith("query")) {
	        		String[] parts = currentline.split(" ");
	        		String querynum = parts[1].substring(0, parts[1].length()-1);
	        		int num = Integer.parseInt(querynum);
	        		int idx = num-1;
	        		if(queries.get(idx) == null)
	        			queries.put(idx, new ArrayList<String>());
	        		queries.get(idx).add(queryString.toString());
	        		queryString = new StringBuffer();
	        		continue;
	        	}
	        	//build up the query string
	        	queryString.append(currentline.trim()+"\n");
	        }
	        reader.close();
		} catch (FileNotFoundException e) {
			System.out.print("Query file not found.\n");
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		Set<Integer> qnum = queries.keySet();
		List<Integer> sort_qnum = new ArrayList<Integer>();
		sort_qnum.addAll(qnum);
		Collections.sort(sort_qnum);
		List<List<String>> q_lst = new ArrayList<List<String>>();
		for(int n:sort_qnum){
			q_lst.add(queries.get(n));
		}
		return q_lst;
	}