public static void main(String[] args) {
		System.out.println( "Available Processors = " + Runtime.getRuntime().availableProcessors() );
		
		try {
			reader = new BufferedReader(new FileReader("CityDataList.txt"));
			writer = new BufferedWriter(new FileWriter("CityDataRecords.csv"));

			try {
				writer.write("\"City Name\",\"Population\",\"Males\",\"Females\",\"Population Change\",\"Median Resident Age\",\"Median Household Income\",\"Per Capita Income\",\"Median Household Value\",\"Median Rent\",\"White Alone\",\"Hispanic\",\"Black\",\"Asian\",\"American Indian\",\"Native Hawaiian\",\"Cost of Living Index\",\"High School\",\"Bachelors Degree\",\"Graduate Degree\",\"Never Married\",\"Now Married\",\"Separated\",\"Widowed\",\"Divorced\",\"Population Density\",\"Land Area\",\"Elevation\",\"Homicide Rate\",\"County Name\"\n");
			} catch (IOException ioe) {
				ioe.printStackTrace();
			}

			String nextLine;
			int i = 0;
			while ((nextLine = reader.readLine()) != null) {
				try {
					if ( i > 0 )
						Thread.sleep(400);
				} catch (InterruptedException ie) {
					ie.printStackTrace();
				} 
				
				String urlString = NameToUrl(nextLine.trim());
				System.out.println(urlString);
				URL url = new URL(urlString);

				BufferedReader respReader = new BufferedReader(
						new InputStreamReader(url.openStream()));
				String resp = "";
				String s;
				while ((s = respReader.readLine()) != null) {
					resp += s;
				}
				respReader.close();

				String cityName = getCityName(urlString);
				System.out.println( cityName );
				
				//non-blocking code
				Thread responseThread = new Thread(new ResponseParser(resp, cityName));
				responseThread.start();
				threadList.add( responseThread );
				
				i++;
			}
			
			//blocking here
			for ( Thread thread : threadList ) {
				try {
					thread.join();
				} catch ( InterruptedException ie ) {
					ie.printStackTrace();
				}
			}

		} catch (IOException ioe) {
			ioe.printStackTrace();
		}

		try {
			reader.close();
			writer.close();
		} catch (IOException ioe) {
			ioe.printStackTrace();
		}
	}