results_and_answers = util.getRunTimesAndAnswer(cur, xjob, yjob)
    results = filterUnknowns(results_and_answers)
    families = util.groupByFamilies(results)
    if input_family == None or input_family == "":
	run_over_families = families
    else:
	if input_family[0] == '-':
 		input_family = input_family[1:]
		exclude_families = input_family.split(',')
		run_over_families = [item for item in families if item not in exclude_families]
        else:
	        run_over_families = input_family.split(',')
    
    util.declareJavaScriptArrays(javascript_file);
    for family in run_over_families:
        family_results = families[family]
        util.dumpFamilyToFile(data_file, family, family_results)
        util.dumpJavaScriptArray(javascript_file, family_results)
        
    for i in range(len(families)):
        util.plotOneScatter(gnuplot_command, data_file_name, i, 2, 3)
        util.plotSeparator(gnuplot_command)
    util.plotDiagonal(gnuplot_command)
    data_file.close()    
    javascript_file.close()
    print gnuplot_command.getvalue()
    gnuplot_command.close()

con.close()
    gnuplot_file_name = base_name + ".gnuplot"
    gnuplot_file = open(gnuplot_file_name, 'w')

    data_file_name = base_name + ".dat"
    data_file = open(data_file_name, 'w')
    
    pdf_file_name = base_name + ".pdf"

    util.setupPlot(gnuplot_file, plot_xlabel, plot_ylabel, plot_title)
    util.setupPdfPlot(gnuplot_file, pdf_file_name)

    util.startPlot(gnuplot_file)

    results = util.selectAllResult(cur, xjob, yjob, xfield, yfield)
    families = util.groupByFamilies(results)

    for family in families:
        family_results = families[family]
        util.dumpFamilyToFile(data_file, family, family_results)

    for i in range(len(families)):
        util.plotOneScatter(gnuplot_file, data_file_name, i, 2, 3)
        util.plotSeparator(gnuplot_file)

    util.plotDiagonal(gnuplot_file)
    data_file.close()    
    gnuplot_file.close()

con.close()