private String createRecordString(Schedule_Record cRecord)
        {
            String returnString = "";
            returnString += cRecord.session;
            //returnString += "," + cRecord.college;
            //returnString += "," + cRecord.department;
            returnString = cRecord.reference;
            returnString += "," + cRecord.course_number;
            returnString += "," + cRecord.section;
            //returnString += "," + cRecord.course_type;
            returnString += "," + cRecord.course_title;
            returnString += "," + cRecord.credit_hours;
            returnString += "," + cRecord.permit;
            returnString += "," + cRecord.status;
            returnString += "," + cRecord.seats_open;
            //returnString += "," + cRecord.seats_cap;
            //returnString += "," + cRecord.seats_used;
            returnString += "," + cRecord.days;
            returnString += "," + cRecord.time;
            returnString += "," + cRecord.building;
            returnString += "," + cRecord.room;
            returnString += "," + cRecord.instructor;
            returnString += "," + cRecord.campus;
            //returnString += "," + cRecord.delivery_method;
            returnString += "," + cRecord.fees;

            return returnString;
        }
        /* Probably the most important function in the entire project
         * This function is used to find which classes conflict with each other
         * and sort the courses based on starting time
         * Its a bit buggy, especially in that it has to go through EACH course
         * and find other courses that conflict with it.
         */
        void find_conflicts()
        {
            Schedule_Record blankSchedule = new Schedule_Record();
            List<List<Schedule_Record>> ScheduleList = new List<List<Schedule_Record>>();
            List<Schedule_Record> mClassSchedule = new List<Schedule_Record>();
            List<Schedule_Record> tClassSchedule = new List<Schedule_Record>();
            List<Schedule_Record> sClassSchedule = new List<Schedule_Record>();
            List<Schedule_Record> multiClassSchedule = new List<Schedule_Record>();
            List<Schedule_Record> otherClassSchedule = new List<Schedule_Record>();

            conflictingSchedule = new List<Schedule_Record>();

            conflictingSchedule.Add(blankSchedule);
            int i, j;
            i = 0; j = 0;

            for (i = 0; i < Schedule.Count; i++)
            {
                if (Schedule[i].getDayType() == 1)
                {
                    mClassSchedule.Add(Schedule[i]);
                }
                else if (Schedule[i].getDayType() == 2)
                {
                    tClassSchedule.Add(Schedule[i]);
                }
                else if (Schedule[i].getDayType() == 4)
                {
                    sClassSchedule.Add(Schedule[i]);
                }
                else if (Schedule[i].getDayType() == 6 || Schedule[i].getDayType() == 3 || Schedule[i].getDayType() == 7)
                {
                    multiClassSchedule.Add(Schedule[i]);
                }
                else if(Schedule[i].getDayType() == 9)
                {
                    otherClassSchedule.Add(Schedule[i]);
                }
                else
                {
                    multiClassSchedule.Add(Schedule[i]);
                }

            }

            foreach (Schedule_Record record in multiClassSchedule)
            {
                List<Schedule_Record> holdMRecords = new List<Schedule_Record>();
                List<Schedule_Record> holdTRecords = new List<Schedule_Record>();
                holdMRecords.Add(record);
                foreach (Schedule_Record testRecord in mClassSchedule)
                {
                    if (record.Conflicts_With(testRecord))
                    {
                        holdMRecords.Add(testRecord);
                    }
                }

                holdTRecords.Add(record);
                foreach (Schedule_Record testRecord in tClassSchedule)
                {
                    if (record.Conflicts_With(testRecord))
                        holdTRecords.Add(testRecord);
                }
                //ScheduleList.Add(holdTRecords);

                if (holdMRecords.Count == 1 && holdTRecords.Count != 1)
                    ScheduleList.Add(holdTRecords);
                else if (holdTRecords.Count == 1 && holdMRecords.Count != 1)
                    ScheduleList.Add(holdMRecords);
                else if (holdMRecords.Count == 1 && holdTRecords.Count == 1)
                    ScheduleList.Add(holdMRecords);
                else
                {
                    ScheduleList.Add(holdMRecords);
                    ScheduleList.Add(holdTRecords);
                }

            }

            for (i = 0; i < mClassSchedule.Count; i++)
            {
                foreach (List<Schedule_Record> recordList in ScheduleList)
                {
                    if (i >= 0 && recordList.Contains(mClassSchedule[i]))
                    {
                        mClassSchedule.RemoveAt(i);
                        i--;
                    }
                }
            }
            for (i = 0; i < tClassSchedule.Count; i++)
            {
                foreach (List<Schedule_Record> recordList in ScheduleList)
                {
                    if (i >= 0 && recordList.Contains(tClassSchedule[i]))
                    {
                        tClassSchedule.RemoveAt(i);
                        i--;
                    }
                }
            }

            for (i = 0; i < mClassSchedule.Count; i++)
            {
                List<Schedule_Record> holdItems = new List<Schedule_Record>();
                holdItems.Add(mClassSchedule[i]);
                for (j = i + 1; j < mClassSchedule.Count; j++)
                {
                    if (!conflictingSchedule.Contains(mClassSchedule[j])
                       && mClassSchedule[i].Conflicts_With(mClassSchedule[j]))
                        holdItems.Add(mClassSchedule[j]);
                }
                if (holdItems.Count > 1)
                {
                    holdItems.Add(blankSchedule);
                    conflictingSchedule.AddRange(holdItems);
                }
                else if (holdItems.Count == 1 && !conflictingSchedule.Contains(holdItems[0]))
                {
                    holdItems.Add(blankSchedule);
                    conflictingSchedule.AddRange(holdItems);
                }
            }

            for (i = 0; i < tClassSchedule.Count; i++)
            {
                List<Schedule_Record> holdItems = new List<Schedule_Record>();
                holdItems.Add(tClassSchedule[i]);
                for (j = i + 1; j < tClassSchedule.Count; j++)
                {
                    if (!conflictingSchedule.Contains(tClassSchedule[j])
                       && tClassSchedule[i].Conflicts_With(tClassSchedule[j]))
                        holdItems.Add(tClassSchedule[j]);
                }
                if (holdItems.Count > 1)
                {
                    holdItems.Add(blankSchedule);
                    conflictingSchedule.AddRange(holdItems);
                }
                else if (holdItems.Count == 1 && !conflictingSchedule.Contains(holdItems[0]))
                {
                    holdItems.Add(blankSchedule);
                    conflictingSchedule.AddRange(holdItems);
                }
            }

            for (i = 0; i < sClassSchedule.Count; i++)
            {
                List<Schedule_Record> holdItems = new List<Schedule_Record>();
                holdItems.Add(sClassSchedule[i]);
                for (j = i + 1; j < sClassSchedule.Count; j++)
                {
                    if (!conflictingSchedule.Contains(sClassSchedule[j])
                       && sClassSchedule[i].Conflicts_With(sClassSchedule[j]))
                        holdItems.Add(sClassSchedule[j]);
                }
                if (holdItems.Count > 1)
                {
                    holdItems.Add(blankSchedule);
                    conflictingSchedule.AddRange(holdItems);
                }
                else if (holdItems.Count == 1 && !conflictingSchedule.Contains(holdItems[0]))
                {
                    holdItems.Add(blankSchedule);
                    conflictingSchedule.AddRange(holdItems);
                }
            }

            foreach (List<Schedule_Record> recordList in ScheduleList)
            {
                foreach (Schedule_Record record in recordList)
                {
                    conflictingSchedule.Add(record);
                }
                conflictingSchedule.Add(blankSchedule);
            }

            foreach (Schedule_Record record in otherClassSchedule)
            {
                conflictingSchedule.Add(record);
                conflictingSchedule.Add(blankSchedule);
            }
            //conflictingSchedule.RemoveAt(conflictingSchedule.Count - 1);

            /*for (i = 0; i < Schedule.Count; i++)
            {
                List<Schedule_Record> holdItems = new List<Schedule_Record>();
                holdItems.Add(Schedule[i]);
                for(j = i + 1; j < Schedule.Count; j++)
                {
                    if(!conflictingSchedule.Contains(Schedule[j])
                       && Schedule[i].Conflicts_With(Schedule[j]))
                          holdItems.Add(Schedule[j]);
                }
                if (holdItems.Count > 1)
                {
                    holdItems.Add(blankSchedule);
                    conflictingSchedule.AddRange(holdItems);
                }
                else if (holdItems.Count == 1 && !conflictingSchedule.Contains(holdItems[0]))
                {
                    holdItems.Add(blankSchedule);
                    conflictingSchedule.AddRange(holdItems);
                }
            }*/
        }
        /* Function to take the HTML of a resulting schdule page, and parse
         * using regexs for the resulting courses
         */
        public void FactorPage(String page)
        {
            // Regexs to get the
            Regex Table = new Regex("(?s)<TABLE CELLSPACING=\"0\" CELLSPADDING=\"0\" BORDER=\"1\" WIDTH=\"100%\">(.+?)</TABLE>");
            Regex Rows = new Regex("(?s)<(TR|TR BORDERCOLOR=\"#C0C0C0\" BGCOLOR=\"#C0C0C0\")>(.+?)</TR>");
            //Regex Item = new Regex("(?m)(?i)<(?:TD)[^>]+>([^>]+)?(?:<A[^>]+>)*([^>]+|)(?:<\\/A>)*([^>]+|)?<\\/(?:TD)>"); // Thanks to Aaron Kalin
            Regex Item = new Regex("(?s)(?i)<TD[^>]+>(.*?)</TD>");  // Thanks to Aaron Kalin
            Regex Subj = new Regex("(?s)(?i)<A[^>]+>(.*?)</A>");

            // Replace breaks with newlines and non-breaking space tags with actual spaces
            page = page.Replace("<BR>", "\n");
            page = page.Replace("&nbsp;", " ");

            List<String> Items = new List<string>();

            foreach(Match m in Table.Matches(page)){
                foreach(Match n in Rows.Matches(m.Groups[1].Value.ToString())){
                    foreach(Match o in Item.Matches(n.Groups[2].Value.ToString())){
                        Items.Add(o.Groups[1].Value.ToString());
                    }

                    Match subjChange = Subj.Match(Items[4]);
                    Items[4] = subjChange.Groups[1].Value.ToString();
                    if(Items[7].Contains("<A")){
                        Regex removeLink = new Regex("(?s)([^<]+(<A[^>]+>).*?(</A>))"); // regex to remove a hyperlink
                                                                                        // but keep the text
                        MatchCollection linkMatch = removeLink.Matches(Items[7]);
                        foreach(Match i in linkMatch){
                            String sMatch = i.Groups[2].Value.ToString();
                            Items[7] = Items[7].Replace(sMatch, "");
                        }
                        Items[7] = Items[7].Replace("</A>","");
                    }
                    if (Items[7].Contains("<a"))
                    {
                        Regex removeLink = new Regex("(?s)([^<]+(<a[^>]+>).*?(</a>))"); // regex to remove a hyperlink
                                                                                        // but keep the text
                        MatchCollection linkMatch = removeLink.Matches(Items[7]);
                        foreach (Match i in linkMatch)
                        {
                            String sMatch = i.Groups[2].Value.ToString();
                            Items[7] = Items[7].Replace(sMatch, "");
                        }
                        Items[7] = Items[7].Replace("</a>", "");
                    }

                    Schedule_Record newRecord = new Schedule_Record(Items);
                    Items.Clear();
                    if(!newRecord.Error_Detected())
                        Schedule.Add(newRecord);
                }
            }
        }