public static void readTemplates(String fileName, boolean resampledFirst, ArrayList<Template> templates){
		try {
			Scanner sc = new Scanner(new File(fileName));

			String curTemplate = "";
			ArrayList<Point> curPoints = null;

			while(sc.hasNext()){
				String cur = sc.next();

				if(cur.charAt(0) == '#'){
					if(!curTemplate.equals("") && curPoints != null){
						templates.add(new Template(curTemplate, curPoints, resampledFirst));
					}

					curTemplate = cur.substring(1);
					curPoints = new ArrayList<Point>();
				} else {
					if(curPoints != null){
						curPoints.add(new Point(Double.parseDouble(cur), Double.parseDouble(sc.next())));
					}
				}
			}
			
			if(!curTemplate.equals("") && curPoints != null){
				//Add the last template
				templates.add(new Template(curTemplate, curPoints, resampledFirst));
			}
		} catch (FileNotFoundException e) {
			log.warn("Can't find file.");
		}

		if(resampledFirst){
			log.debug(templates.size()+" resampled first templates loaded.");
		} else {
			log.debug(templates.size()+" resampled last templates loaded.");
		}
	}