public String updateMarketIndexData(String index, String arg) {
        String dataText = "";
        String urlvar = "";
        String urlfull = "";
        String in = "";
        
        /* Build the appropriate URL string.
        urlbase is the beginning format of all CSV data requests.
        urlvar is the format for requesting the asking price of a stock.
        urlfull is the concatenation (urlbase + sym + urlvar) to form a full
        valid URL for this type of request.
        */
        String urlbase = "http://finance.yahoo.com/d/quotes.csv?s=";
        urlvar = index.concat("&f=").concat(arg);
        urlfull = urlbase.concat(urlvar);

        try {
        	// Build the URL object and ready our input stream.
            URL url = new URL(urlfull);
            BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
            
            /* Read from the stream.
             */
            while ((in = br.readLine()) != null) {
                dataText = in;
            }

            br.close();
        } catch (MalformedURLException e) {
            System.out.println("Bad URL");
            e.printStackTrace();
            System.exit(1);
        } catch (UnknownHostException e) {
            System.out.println("Unknown Host");
            e.printStackTrace();
            System.exit(1);
        } catch (IOException e) {
            System.out.println("IO Exception");
            e.printStackTrace();
            System.exit(1);
        } catch (NumberFormatException e) {
            if (in.equals("N/A")) {
                System.out.println("Finance API returned junk data."
                        + " The stock ticker may be incorrect.");
            } else {
                System.out.println("NumberFormatException caused by"
                        + " string " + in);
                e.printStackTrace();
            }
        }
        
        if(arg.equals("c6") || arg.equals("p2")) {
            return dataText.substring(1, dataText.length() - 1);
        }
        else {
            return dataText;
        }
    }