/// <summary> Reads the MARC Core-compliant section of XML and stores the data in the provided digital resource </summary>
        /// <param name="r"> XmlTextReader from which to read the marc data </param>
        /// <param name="thisBibInfo">Bibliographic object into which most the values are read</param>
        /// <param name="package"> Digital resource object to save the data to if this is reading the top-level bibDesc (OPTIONAL)</param>
        /// <param name="Importing_Record"> Importing record flag is used to determine if special treatment should be applied to the 001 identifier.  If this is reading MarcXML from a dmdSec, this is set to false </param>
        /// <param name="Options"> Dictionary of any options which this metadata reader/writer may utilize </param>
        public static void Read_MarcXML_Info(XmlReader r, Bibliographic_Info thisBibInfo, SobekCM_Item package, bool Importing_Record, Dictionary<string, object> Options )
        {
            // Create the MARC_XML_Reader to load everything into first
            MARC_Record record = new MARC_Record();

            // Read from the file
            record.Read_MARC_Info(r);

            // Handle optional mapping first for retaining the 856 as a related link
            if ((Options != null) && (Options.ContainsKey("MarcXML_File_ReaderWriter.Retain_856_As_Related_Link")))
            {
                if (Options["MarcXML_File_ReaderWriter.Retain_856_As_Related_Link"].ToString().ToUpper() == "TRUE")
                {
                    if ((record.Get_Data_Subfield(856, 'u').Length > 0) && (record.Get_Data_Subfield(856, 'y').Length > 0))
                    {
                        string url856 = record.Get_Data_Subfield(856, 'u');
                        string label856 = record.Get_Data_Subfield(856, 'y');

                        thisBibInfo.Location.Other_URL = url856;
                        thisBibInfo.Location.Other_URL_Note = label856;
                    }
                }
            }

            // Now, load values into the bib package
            // Load the date ( 260 |c )
            thisBibInfo.Origin_Info.MARC_DateIssued = Remove_Trailing_Punctuation(record.Get_Data_Subfield(260, 'c'));

            // Load the descriptions and notes about this item
            Add_Descriptions(thisBibInfo, record);

            // Look for the 786  with special identifiers to map back into the source notes
            foreach (MARC_Field thisRecord in record[786])
            {
                if ((thisRecord.Indicators == "0 ") && (thisRecord.Subfield_Count == 1) && (thisRecord.has_Subfield('n')))
                    thisBibInfo.Add_Note(thisRecord.Subfields[0].Data, Note_Type_Enum.Source);
            }

            // Add the contents (505)
            if (record.Get_Data_Subfield(505, 'a').Length > 2)
            {
                thisBibInfo.Add_TableOfContents(record.Get_Data_Subfield(505, 'a'));
            }

            // Get the scale information (034)
            if (record.Get_Data_Subfield(034, 'b').Length > 2)
            {
                thisBibInfo.Add_Scale(record.Get_Data_Subfield(034, 'b'), "SUBJ034");
            }

            // Get the scale information (255)
            if ((record.Get_Data_Subfield(255, 'a').Length > 2) || (record.Get_Data_Subfield(255, 'b').Length > 2) || (record.Get_Data_Subfield(255, 'c').Length > 2))
            {
                thisBibInfo.Add_Scale(record.Get_Data_Subfield(255, 'a'), record.Get_Data_Subfield(255, 'b'), record.Get_Data_Subfield(255, 'c'), "SUBJ255");
            }

            // Get the coordinate information (034)
            if ((record.Get_Data_Subfield(034, 'd').Length > 0) && (record.Get_Data_Subfield(034, 'e').Length > 0) && (record.Get_Data_Subfield(034, 'f').Length > 0) && (record.Get_Data_Subfield(034, 'g').Length > 0))
            {
                // This is an extra metadata component
                GeoSpatial_Information geoInfo = package.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information;
                if (geoInfo == null)
                {
                    geoInfo = new GeoSpatial_Information();
                    package.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoInfo);
                }

                if (geoInfo.Polygon_Count == 0)
                {
                    try
                    {

                        string d_field = record.Get_Data_Subfield(034, 'd').Replace("O", "0");
                        string e_field = record.Get_Data_Subfield(034, 'e').Replace("O", "0");
                        string f_field = record.Get_Data_Subfield(034, 'f').Replace("O", "0");
                        string g_field = record.Get_Data_Subfield(034, 'g').Replace("O", "0");

                        double d_value = 1;
                        double e_value = 1;
                        double f_value = 1;
                        double g_value = 1;

                        if (d_field.Contains("."))
                        {
                            if (d_field.Contains("W"))
                            {
                                d_value = -1*Convert.ToDouble(d_field.Replace("W", ""));
                            }
                            else
                            {
                                d_value = Convert.ToDouble(d_field.Replace("E", ""));
                            }
                        }
                        else
                        {
                            d_value = Convert.ToDouble(d_field.Substring(1, 3)) + (Convert.ToDouble(d_field.Substring(4, 2))/60);

                            if ((d_field[0] == '-') || (d_field[0] == 'W'))
                            {
                                d_value = -1*d_value;
                            }
                        }

                        if (d_value < -180)
                            d_value = d_value + 360;

                        if (e_field.Contains("."))
                        {
                            if (e_field.Contains("W"))
                            {
                                e_value = -1*Convert.ToDouble(e_field.Replace("W", ""));
                            }
                            else
                            {
                                e_value = Convert.ToDouble(e_field.Replace("E", ""));
                            }
                        }
                        else
                        {
                            e_value = Convert.ToDouble(e_field.Substring(1, 3)) + (Convert.ToDouble(e_field.Substring(4, 2))/60);

                            if ((e_field[0] == '-') || (e_field[0] == 'W'))
                            {
                                e_value = -1*e_value;
                            }
                        }

                        if (e_value < -180)
                            e_value = e_value + 360;

                        if (f_field.Contains("."))
                        {
                            if (f_field.Contains("S"))
                            {
                                f_value = -1*Convert.ToDouble(f_field.Replace("S", ""));
                            }
                            else
                            {
                                f_value = Convert.ToDouble(f_field.Replace("N", ""));
                            }
                        }
                        else
                        {
                            f_value = Convert.ToDouble(f_field.Substring(1, 3)) + (Convert.ToDouble(f_field.Substring(4, 2))/60);

                            if ((f_field[0] == '-') || (f_field[0] == 'S'))
                            {
                                f_value = -1*f_value;
                            }
                        }

                        if (g_field.Contains("."))
                        {
                            if (g_field.Contains("S"))
                            {
                                g_value = -1*Convert.ToDouble(g_field.Replace("S", ""));
                            }
                            else
                            {
                                g_value = Convert.ToDouble(g_field.Replace("N", ""));
                            }
                        }
                        else
                        {
                            g_value = Convert.ToDouble(g_field.Substring(1, 3)) + (Convert.ToDouble(g_field.Substring(4, 2))/60);

                            if ((g_field[0] == '-') || (g_field[0] == 'S'))
                            {
                                g_value = -1*g_value;
                            }
                        }
                        Coordinate_Polygon polygon = new Coordinate_Polygon();
                        polygon.Add_Edge_Point(f_value, d_value);
                        polygon.Add_Edge_Point(g_value, d_value);
                        polygon.Add_Edge_Point(g_value, e_value);
                        polygon.Add_Edge_Point(f_value, e_value);
                        polygon.Label = "Map Coverage";
                        geoInfo.Add_Polygon(polygon);
                    }
                    catch {   }
                }
            }

            // Add the abstract ( 520 |a )
            foreach (MARC_Field thisRecord in record[520])
            {
                if (thisRecord.has_Subfield('a'))
                {
                    Abstract_Info newAbstract = new Abstract_Info();
                    switch (thisRecord.Indicator1)
                    {
                        case ' ':
                            newAbstract.Type = "summary";
                            newAbstract.Display_Label = "Summary";
                            break;

                        case '0':
                            newAbstract.Type = "subject";
                            newAbstract.Display_Label = "Subject";
                            break;

                        case '1':
                            newAbstract.Type = "review";
                            newAbstract.Display_Label = "Review";
                            break;

                        case '2':
                            newAbstract.Type = "scope and content";
                            newAbstract.Display_Label = "Scope and Content";
                            break;

                        case '4':
                            newAbstract.Type = "content advice";
                            newAbstract.Display_Label = "Content Advice";
                            break;

                        default:
                            newAbstract.Display_Label = "Abstract";
                            break;
                    }

                    if (thisRecord.has_Subfield('b'))
                    {
                        newAbstract.Abstract_Text = thisRecord['a'] + " " + thisRecord['b'];
                    }
                    else
                    {
                        newAbstract.Abstract_Text = thisRecord['a'];
                    }
                    thisBibInfo.Add_Abstract(newAbstract);
                }
            }

            // Load the format ( 300 )
            if (record.has_Field(300))
            {
                StringBuilder builder300 = new StringBuilder();
                if (record.Get_Data_Subfield(300, 'a').Length > 0)
                {
                    builder300.Append(record.Get_Data_Subfield(300, 'a').Replace(":", "").Replace(";", "").Trim());
                }
                builder300.Append(" : ");
                if (record.Get_Data_Subfield(300, 'b').Length > 0)
                {
                    builder300.Append(record.Get_Data_Subfield(300, 'b').Replace(";", "").Trim());
                }
                builder300.Append(" ; ");
                if (record.Get_Data_Subfield(300, 'c').Length > 0)
                {
                    builder300.Append(record.Get_Data_Subfield(300, 'c'));
                }
                thisBibInfo.Original_Description.Extent = builder300.ToString().Trim();
                if (thisBibInfo.Original_Description.Extent.Replace(" ", "").Replace(":", "").Replace(";", "") == "v.")
                    thisBibInfo.Original_Description.Extent = String.Empty;
            }

            // Load the current frequency (310)
            foreach (MARC_Field thisRecord in record[310])
            {
                if (thisRecord.has_Subfield('a'))
                {
                    if (thisRecord.has_Subfield('b'))
                    {
                        thisBibInfo.Origin_Info.Add_Frequency(Remove_Trailing_Punctuation(thisRecord['a']).Replace("[", "(").Replace("]", ")") + "[" + thisRecord['b'].Replace("[", "(").Replace("]", ")") + "]");
                    }
                    else
                    {
                        thisBibInfo.Origin_Info.Add_Frequency(Remove_Trailing_Punctuation(thisRecord['a']).Replace("[", "(").Replace("]", ")"));
                    }
                }
            }

            // Load the previous frequency (321)
            foreach (MARC_Field thisRecord in record[321])
            {
                if (thisRecord.has_Subfield('a'))
                {
                    if (thisRecord.has_Subfield('b'))
                    {
                        thisBibInfo.Origin_Info.Add_Frequency(Remove_Trailing_Punctuation(thisRecord['a']).Replace("[", "(").Replace("]", ")") + "[ FORMER " + thisRecord['b'].Replace("[", "(").Replace("]", ")") + "]");
                    }
                    else
                    {
                        thisBibInfo.Origin_Info.Add_Frequency(Remove_Trailing_Punctuation(thisRecord['a']).Replace("[", "(").Replace("]", ")") + "[ FORMER ]");
                    }
                }
            }

            // Load the edition ( 250 )
            if (record.has_Field(250))
            {
                if (record.Get_Data_Subfield(250, 'b').Length > 0)
                {
                    thisBibInfo.Origin_Info.Edition = record.Get_Data_Subfield(250, 'a').Replace("/", "").Replace("=", "").Trim() + " -- " + record.Get_Data_Subfield(250, 'b');
                }
                else
                {
                    thisBibInfo.Origin_Info.Edition = record.Get_Data_Subfield(250, 'a');
                }
            }

            // Load the language ( 008 )
            if (record.has_Field(8))
            {
                string field_08 = record[8][0].Control_Field_Value;
                if (field_08.Length > 5)
                {
                    // Get the language code
                    string languageCode = field_08.Substring(field_08.Length - 5, 3);

                    // Add as the language of the item
                    Language_Info thisLanguage = thisBibInfo.Add_Language(String.Empty, languageCode, String.Empty);

                    // Add as the language of the cataloging
                    thisBibInfo.Record.Add_Catalog_Language(new Language_Info(thisLanguage.Language_Text, thisLanguage.Language_ISO_Code, String.Empty));
                }
            }

            // Load any additional languages (041)
            foreach (MARC_Field thisRecord in record[041])
            {
                foreach (MARC_Subfield thisSubfield in thisRecord.Subfields)
                {
                    if ((thisSubfield.Subfield_Code == 'a') || (thisSubfield.Subfield_Code == 'b') || (thisSubfield.Subfield_Code == 'd') ||
                        (thisSubfield.Subfield_Code == 'e') || (thisSubfield.Subfield_Code == 'f') || (thisSubfield.Subfield_Code == 'g') ||
                        (thisSubfield.Subfield_Code == 'h'))
                    {
                        thisBibInfo.Add_Language(thisSubfield.Data);
                    }
                }
            }

            // Load the publisher ( 260 |b )
            if (record.has_Field(260))
            {
                string[] special_260_splitter = record[260][0].Control_Field_Value.Split("|".ToCharArray());
                Publisher_Info thisInfo = new Publisher_Info();
                foreach (string thisSplitter in special_260_splitter)
                {
                    if (thisSplitter.Length > 2)
                    {
                        if (thisSplitter[0] == 'a')
                        {
                            thisInfo.Add_Place(Remove_Trailing_Punctuation(thisSplitter.Substring(2).Replace(" :", "").Trim()));
                            thisInfo.Name = "[s.n.]";
                            thisBibInfo.Add_Publisher(thisInfo);
                        }

                        if (thisSplitter[0] == 'b')
                        {
                            string pubname = thisSplitter.Substring(2).Replace(";", "").Trim();
                            if ((pubname.Length > 1) && (pubname[pubname.Length - 1] == ','))
                            {
                                pubname = pubname.Substring(0, pubname.Length - 1);
                            }

                            thisInfo.Name = pubname;
                            thisBibInfo.Add_Publisher(thisInfo);
                            thisInfo = new Publisher_Info();
                        }

                        if (thisSplitter[0] == 'e')
                        {
                            thisInfo.Add_Place(thisSplitter.Substring(2).Replace("(", "").Replace(" :", "").Trim());
                        }

                        if (thisSplitter[0] == 'f')
                        {
                            string manname = thisSplitter.Substring(2).Replace(")", "").Trim();
                            if ((manname.Length > 1) && (manname[manname.Length - 1] == ','))
                            {
                                manname = manname.Substring(0, manname.Length - 1);
                            }

                            thisInfo.Name = manname;
                            thisBibInfo.Add_Manufacturer(thisInfo);
                            thisInfo = new Publisher_Info();
                        }
                    }
                }
            }

            // Load the dates from the 008
            string field_008 = String.Empty;
            if (record.has_Field(008))
            {
                field_008 = record[8][0].Control_Field_Value;
                if (field_008.Length > 14)
                {
                    // Save the two date points
                    thisBibInfo.Origin_Info.MARC_DateIssued_Start = field_008.Substring(7, 4).Trim();
                    thisBibInfo.Origin_Info.MARC_DateIssued_End = field_008.Substring(11, 4).Trim();

                    // See what type of dates they are (if they are special)
                    char date_type = field_008[6];
                    switch (date_type)
                    {
                        case 'r':
                            thisBibInfo.Origin_Info.Date_Reprinted = thisBibInfo.Origin_Info.MARC_DateIssued_Start;
                            break;

                        case 't':
                            thisBibInfo.Origin_Info.Date_Copyrighted = thisBibInfo.Origin_Info.MARC_DateIssued_End;
                            break;
                    }
                }

                if (field_008.Length > 5)
                {
                    thisBibInfo.Record.MARC_Creation_Date = field_008.Substring(0, 6);
                }
            }

            // Load the location from the 008
            if (field_008.Length > 17)
            {
                thisBibInfo.Origin_Info.Add_Place(String.Empty, field_008.Substring(15, 3), String.Empty);
            }

            // Load the main record number ( 001 )
            string idValue;
            string oclc = String.Empty;
            if (record.has_Field(1))
            {
                idValue = record[1][0].Control_Field_Value.Trim();
                if (idValue.Length > 0)
                {
                    thisBibInfo.Record.Main_Record_Identifier.Identifier = idValue;
                    if (Importing_Record)
                    {
                        if (Char.IsNumber(idValue[0]))
                        {
                            // Add this ALEPH number
                            if (thisBibInfo.ALEPH_Record != idValue)
                            {
                                thisBibInfo.Add_Identifier(idValue, "ALEPH");
                            }
                            thisBibInfo.Record.Record_Origin = "Imported from (ALEPH)" + idValue;
                        }
                        else
                        {
                            if (idValue.Length >= 7)
                            {
                                if ((idValue.IndexOf("ocm") == 0) || (idValue.IndexOf("ocn") == 0))
                                {
                                    oclc = idValue.Replace("ocn", "").Replace("ocm", "");
                                    if (thisBibInfo.OCLC_Record != oclc)
                                    {
                                        thisBibInfo.Add_Identifier(oclc, "OCLC");
                                    }
                                    thisBibInfo.Record.Record_Origin = "Imported from (OCLC)" + oclc;
                                }
                                else
                                {
                                    thisBibInfo.Add_Identifier(idValue.Substring(0, 7), "NOTIS");
                                    thisBibInfo.Record.Record_Origin = "Imported from (NOTIS)" + idValue.Substring(0, 7);
                                }
                            }
                        }
                    }
                }
            }

            // If this was OCLC record (non-local) look for a 599 added during time of export
            if (oclc.Length > 0)
            {
                if (record.has_Field(599))
                {
                    // Tracking box number will be in the |a field
                    if ((package != null) && (record[599][0].has_Subfield('a')))
                    {
                        package.Tracking.Tracking_Box = record[599][0]['a'];
                    }

                    // Disposition advice will be in the |b field
                    if ((package != null) && (record[599][0].has_Subfield('b')))
                    {
                        package.Tracking.Disposition_Advice_Notes = record[599][0]['b'];
                        string advice_notes_as_caps = package.Tracking.Disposition_Advice_Notes.ToUpper();
                        if ((advice_notes_as_caps.IndexOf("RETURN") >= 0) || (advice_notes_as_caps.IndexOf("RETAIN") >= 0))
                        {
                            package.Tracking.Disposition_Advice = 1;
                        }
                        else
                        {
                            if (advice_notes_as_caps.IndexOf("WITHDRAW") >= 0)
                            {
                                package.Tracking.Disposition_Advice = 2;
                            }
                            else if (advice_notes_as_caps.IndexOf("DISCARD") >= 0)
                            {
                                package.Tracking.Disposition_Advice = 3;
                            }
                        }
                    }

                    // Do not overlay record in the future will be in the |c field
                    if (record[599][0].has_Subfield('c'))
                    {
                        string record_overlay_notes = record[599][0]['c'].Trim();
                        if (record_overlay_notes.Length > 0)
                        {
                            if (package != null)
                            {
                                package.Tracking.Never_Overlay_Record = true;
                                package.Tracking.Internal_Comments = record_overlay_notes;
                            }
                            thisBibInfo.Record.Record_Content_Source = thisBibInfo.Record.Record_Content_Source + " (" + record_overlay_notes + ")";
                        }
                    }
                }
            }

            // Step through all of the identifiers
            foreach (MARC_Field thisRecord in record[35])
            {
                // Only continue if there is an id in this record
                if (thisRecord.has_Subfield('a'))
                {
                    // Was this the old NOTIS number?
                    if (thisRecord.Indicators == "9 ")
                    {
                        thisBibInfo.Add_Identifier(thisRecord['a'], "NOTIS");
                    }

                    // Was this the OCLC number?
                    if ((oclc.Length == 0) && (thisRecord['a'].ToUpper().IndexOf("OCOLC") >= 0))
                    {
                        thisBibInfo.Add_Identifier(thisRecord['a'].ToUpper().Replace("(OCOLC)", "").Trim(), "OCLC");
                    }

                    // Was this the BIB ID?
                    if ((package != null) && (thisRecord['a'].ToUpper().IndexOf("IID") >= 0))
                    {
                        package.BibID = thisRecord['a'].ToUpper().Replace("(IID)", "").Trim();
                    }
                }
            }

            // Also, look for the old original OCLC in the 776 10 |w
            if (thisBibInfo.OCLC_Record.Length == 0)
            {
                foreach (MARC_Field thisRecord in record[776])
                {
                    if ((thisRecord.Indicators == "1 ") && (thisRecord.has_Subfield('w')) && (thisRecord['w'].ToUpper().IndexOf("OCOLC") >= 0))
                    {
                        thisBibInfo.Add_Identifier(thisRecord['w'].ToUpper().Replace("(OCOLC)", "").Trim(), "OCLC");
                    }
                }
            }

            // Look for the LCCN in field 10
            if (record.Get_Data_Subfield(10, 'a').Length > 0)
                thisBibInfo.Add_Identifier(record.Get_Data_Subfield(10, 'a'), "LCCN");

            // Look for ISBN in field 20
            if (record.Get_Data_Subfield(20, 'a').Length > 0)
                thisBibInfo.Add_Identifier(record.Get_Data_Subfield(20, 'a'), "ISBN");

            // Look for ISSN in field 22
            if (record.Get_Data_Subfield(22, 'a').Length > 0)
                thisBibInfo.Add_Identifier(record.Get_Data_Subfield(22, 'a'), "ISSN");

            // Look for classification ( LCC ) in field 50
            if (record.Get_Data_Subfield(50, 'a').Length > 0)
            {
                string subfield_3 = String.Empty;
                if (record.Get_Data_Subfield(50, '3').Length > 0)
                {
                    subfield_3 = record.Get_Data_Subfield(50, '3');
                }
                if (record.Get_Data_Subfield(50, 'b').Length > 0)
                    thisBibInfo.Add_Classification(record.Get_Data_Subfield(50, 'a') + " " + record.Get_Data_Subfield(50, 'b'), "lcc").Display_Label = subfield_3;
                else
                    thisBibInfo.Add_Classification(record.Get_Data_Subfield(50, 'a'), "lcc").Display_Label = subfield_3;
            }

            // Look for classification ( DDC ) in field 82
            if (record.Get_Data_Subfield(82, 'a').Length > 0)
            {
                string subfield_2 = String.Empty;
                if (record.Get_Data_Subfield(82, '2').Length > 0)
                {
                    subfield_2 = record.Get_Data_Subfield(82, '2');
                }
                if (record.Get_Data_Subfield(82, 'b').Length > 0)
                    thisBibInfo.Add_Classification(record.Get_Data_Subfield(82, 'a') + " " + record.Get_Data_Subfield(82, 'b'), "ddc").Edition = subfield_2;
                else
                    thisBibInfo.Add_Classification(record.Get_Data_Subfield(82, 'a'), "ddc").Edition = subfield_2;
            }

            // Look for classification ( UDC ) in field 80
            if (record.Get_Data_Subfield(80, 'a').Length > 0)
            {
                StringBuilder builder = new StringBuilder();
                builder.Append(record.Get_Data_Subfield(80, 'a'));
                if (record.Get_Data_Subfield(80, 'b').Length > 0)
                    builder.Append(" " + record.Get_Data_Subfield(80, 'b'));
                if (record.Get_Data_Subfield(80, 'x').Length > 0)
                    builder.Append(" " + record.Get_Data_Subfield(80, 'x'));
                thisBibInfo.Add_Classification(builder.ToString(), "udc");
            }

            // Look for classification ( NLM ) in field 60
            if (record.Get_Data_Subfield(60, 'a').Length > 0)
            {
                if (record.Get_Data_Subfield(60, 'b').Length > 0)
                    thisBibInfo.Add_Classification(record.Get_Data_Subfield(60, 'a') + " " + record.Get_Data_Subfield(60, 'b'), "nlm");
                else
                    thisBibInfo.Add_Classification(record.Get_Data_Subfield(60, 'a'), "nlm");
            }

            // Look for classification ( SUDOCS or CANDOCS ) in field 86
            foreach (MARC_Field thisRecord in record[84])
            {
                string authority = String.Empty;
                switch (thisRecord.Indicator1)
                {
                    case '0':
                        authority = "sudocs";
                        break;

                    case '1':
                        authority = "candocs";
                        break;

                    default:
                        if (thisRecord.has_Subfield('2'))
                            authority = thisRecord['2'];
                        break;
                }

                if (thisRecord.has_Subfield('a'))
                    thisBibInfo.Add_Classification(thisRecord['a'], authority);
            }

            // Look for other classifications in field 084
            foreach (MARC_Field thisRecord in record[84])
            {
                if (thisRecord.has_Subfield('a'))
                {
                    string subfield_2 = String.Empty;
                    if (thisRecord.has_Subfield('2'))
                    {
                        subfield_2 = thisRecord['2'];
                    }
                    if (thisRecord.has_Subfield('b'))
                        thisBibInfo.Add_Classification(thisRecord['a'] + " " + thisRecord['b'], subfield_2);
                    else
                        thisBibInfo.Add_Classification(thisRecord['a'], subfield_2);
                }
            }

            // Look for any other identifiers in field 24
            foreach (MARC_Field thisRecord in record[24])
            {
                string identifier_source = String.Empty;
                switch (thisRecord.Indicator1)
                {
                    case '0':
                        identifier_source = "isrc";
                        break;

                    case '1':
                        identifier_source = "upc";
                        break;

                    case '2':
                        identifier_source = "ismn";
                        break;

                    case '3':
                        identifier_source = "ian";
                        break;

                    case '4':
                        identifier_source = "sici";
                        break;

                    case '7':
                        identifier_source = thisRecord['2'];
                        break;
                }

                if (thisRecord.has_Subfield('d'))
                {
                    thisBibInfo.Add_Identifier(thisRecord['a'] + " (" + thisRecord['d'] + ")", identifier_source);
                }
                else
                {
                    thisBibInfo.Add_Identifier(thisRecord['a'], identifier_source);
                }
            }

            // Look for the ISSN in the 440 and 490 |x and LCCN in the 490 |l
            foreach (MARC_Field thisRecord in record[440])
            {
                if (thisRecord.has_Subfield('x'))
                {
                    thisBibInfo.Add_Identifier(thisRecord['x'], "ISSN");
                }
            }
            foreach (MARC_Field thisRecord in record[490])
            {
                if (thisRecord.has_Subfield('x'))
                {
                    thisBibInfo.Add_Identifier(thisRecord['x'], "ISSN");
                }
                if (thisRecord.has_Subfield('l'))
                {
                    thisBibInfo.Add_Identifier(thisRecord['l'], "LCCN");
                }
            }

            // Load all the MARC Content Sources (040)
            if (record.has_Field(40))
            {
                if (record.Get_Data_Subfield(40, 'a').Length > 0)
                {
                    thisBibInfo.Record.Add_MARC_Record_Content_Sources(record.Get_Data_Subfield(40, 'a'));
                }
                if (record.Get_Data_Subfield(40, 'b').Length > 0)
                {
                    thisBibInfo.Record.Add_MARC_Record_Content_Sources(record.Get_Data_Subfield(40, 'b'));
                }
                if (record.Get_Data_Subfield(40, 'c').Length > 0)
                {
                    thisBibInfo.Record.Add_MARC_Record_Content_Sources(record.Get_Data_Subfield(40, 'c'));
                }
                string modifying = record.Get_Data_Subfield(40, 'd');
                if (modifying.Length > 0)
                {
                    string[] modSplitter = modifying.Split("|".ToCharArray());
                    foreach (string split in modSplitter)
                    {
                        thisBibInfo.Record.Add_MARC_Record_Content_Sources(split.Trim());
                    }
                }
                if (record.Get_Data_Subfield(40, 'e').Length > 0)
                {
                    thisBibInfo.Record.Description_Standard = record.Get_Data_Subfield(40, 'e');
                }
            }

            // Add the spatial information ( 752, 662 )
            Add_Hierarchical_Subject(thisBibInfo, record, 752);
            Add_Hierarchical_Subject(thisBibInfo, record, 662);

            // Add all the subjects ( 600... 658, excluding 655 )
            Add_Personal_Name(thisBibInfo, record, 600, 4);
            Add_Corporate_Name(thisBibInfo, record, 610, 4);
            Add_Conference_Name(thisBibInfo, record, 611, 4);
            Add_Main_Title(thisBibInfo, record, 630, Title_Type_Enum.UNSPECIFIED, 1, 4);

            // Add all additional subjects
            // Letters indicate which fields are: TOPICAL, GEOGRAPHIC, TEMPORAL, GENRE, OCCUPATION
            Add_Subject(thisBibInfo, record, 648, "x", "z", "ay", "v", "");
            Add_Subject(thisBibInfo, record, 650, "ax", "z", "y", "v", "");
            Add_Subject(thisBibInfo, record, 651, "x", "az", "y", "v", "");
            Add_Subject(thisBibInfo, record, 653, "a", "", "", "", "");
            Add_Subject(thisBibInfo, record, 654, "av", "y", "z", "", "");
            Add_Subject(thisBibInfo, record, 655, "x", "z", "y", "av", "");
            Add_Subject(thisBibInfo, record, 656, "x", "z", "y", "v", "a");
            Add_Subject(thisBibInfo, record, 657, "ax", "z", "y", "v", "");
            Add_Subject(thisBibInfo, record, 690, "ax", "z", "y", "v", "");
            Add_Subject(thisBibInfo, record, 691, "x", "az", "y", "v", "");

            // Add the genres (655 -- again)
            foreach (MARC_Field thisRecord in record[655])
            {
                if (thisRecord.has_Subfield('a'))
                {
                    if (thisRecord.has_Subfield('2'))
                        thisBibInfo.Add_Genre(thisRecord['a'], thisRecord['2']);
                    else
                        thisBibInfo.Add_Genre(thisRecord['a']);
                }
            }

            // Add the abbreviated title (210)
            foreach (MARC_Field thisRecord in record[210])
            {
                if (thisRecord.has_Subfield('a'))
                {
                    Title_Info abbrTitle = new Title_Info(thisRecord['a'], Title_Type_Enum.Abbreviated);
                    if (thisRecord.has_Subfield('b'))
                        abbrTitle.Subtitle = thisRecord['b'];
                    thisBibInfo.Add_Other_Title(abbrTitle);
                }
            }

            // Add the title ( 245 |a, |b )
            Add_Main_Title(thisBibInfo, record, 245, Title_Type_Enum.UNSPECIFIED, 2, 1);

            // Add the translated titles ( 242 )
            Add_Main_Title(thisBibInfo, record, 242, Title_Type_Enum.Translated, 2, 2);

            // Add the alternative titles ( 246, 740 )
            Add_Main_Title(thisBibInfo, record, 246, Title_Type_Enum.Alternative, 0, 2);
            Add_Main_Title(thisBibInfo, record, 740, Title_Type_Enum.Alternative, 1, 2);

            // Add the uniform titles (130, 240, 730 )
            Add_Main_Title(thisBibInfo, record, 130, Title_Type_Enum.Uniform, 1, 2);
            Add_Main_Title(thisBibInfo, record, 240, Title_Type_Enum.Uniform, 2, 2);
            Add_Main_Title(thisBibInfo, record, 730, Title_Type_Enum.Uniform, 1, 2);

            // Add the series titles ( 440, 490 )
            Add_Main_Title(thisBibInfo, record, 440, Title_Type_Enum.UNSPECIFIED, 2, 3);
            Add_Main_Title(thisBibInfo, record, 490, Title_Type_Enum.UNSPECIFIED, 0, 3);

            // Add the creators and contributors ( 100, 110 , 111, 700, 710, 711, 720, 796, 797 )
            Add_Personal_Name(thisBibInfo, record, 100, 1);
            Add_Personal_Name(thisBibInfo, record, 700, 2);
            Add_Personal_Name(thisBibInfo, record, 796, 3);
            Add_Corporate_Name(thisBibInfo, record, 110, 1);
            Add_Corporate_Name(thisBibInfo, record, 710, 2);
            Add_Corporate_Name(thisBibInfo, record, 797, 3);
            Add_Conference_Name(thisBibInfo, record, 111, 1);
            Add_Conference_Name(thisBibInfo, record, 711, 2);

            // Add the Other Edition Value (775)
            foreach (MARC_Field thisRecord in record[775])
            {
                Related_Item_Info otherEditionItem = new Related_Item_Info();
                otherEditionItem.Relationship = Related_Item_Type_Enum.OtherVersion;
                if (thisRecord.has_Subfield('t'))
                    otherEditionItem.Main_Title.Title = thisRecord['t'];
                if (thisRecord.has_Subfield('x'))
                    otherEditionItem.Add_Identifier(thisRecord['x'], "issn");
                if (thisRecord.has_Subfield('z'))
                    otherEditionItem.Add_Identifier(thisRecord['z'], "isbn");
                if (thisRecord.has_Subfield('w'))
                {
                    string[] splitter = thisRecord['w'].Split("|".ToCharArray());
                    foreach (string thisSplitter in splitter)
                    {
                        if (thisSplitter.IndexOf("(DLC)sn") >= 0)
                        {
                            otherEditionItem.Add_Identifier(thisSplitter.Replace("(DLC)sn", "").Trim(), "lccn");
                        }
                        if (thisSplitter.IndexOf("(OCoLC)") >= 0)
                        {
                            otherEditionItem.Add_Identifier(thisSplitter.Replace("(OCoLC)", "").Trim(), "oclc");
                        }
                    }
                }
                thisBibInfo.Add_Related_Item(otherEditionItem);
            }

            // Add the Preceding Entry (780)
            foreach (MARC_Field thisRecord in record[780])
            {
                Related_Item_Info precedingItem = new Related_Item_Info();
                precedingItem.Relationship = Related_Item_Type_Enum.Preceding;
                if (thisRecord.has_Subfield('t'))
                    precedingItem.Main_Title.Title = thisRecord['t'];
                if (thisRecord.has_Subfield('x'))
                    precedingItem.Add_Identifier(thisRecord['x'], "issn");
                if (thisRecord.has_Subfield('z'))
                    precedingItem.Add_Identifier(thisRecord['z'], "isbn");
                if (thisRecord.has_Subfield('w'))
                {
                    string[] splitter = thisRecord['w'].Split("|".ToCharArray());
                    foreach (string thisSplitter in splitter)
                    {
                        if ((thisSplitter.IndexOf("(DLC)sn") >= 0) || (thisSplitter.IndexOf("(OCoLC)") >= 0))
                        {
                            if (thisSplitter.IndexOf("(DLC)sn") >= 0)
                            {
                                precedingItem.Add_Identifier(thisSplitter.Replace("(DLC)sn", "").Trim(), "lccn");
                            }
                            if (thisSplitter.IndexOf("(OCoLC)") >= 0)
                            {
                                precedingItem.Add_Identifier(thisSplitter.Replace("(OCoLC)", "").Trim(), "oclc");
                            }
                        }
                        else
                        {
                            precedingItem.Add_Identifier(thisSplitter.Trim(), String.Empty);
                        }
                    }
                    if (thisRecord.has_Subfield('o'))
                    {
                        if (thisRecord['o'].IndexOf("(SobekCM)") >= 0)
                            precedingItem.SobekCM_ID = thisRecord['o'].Replace("(SobekCM)", "").Trim();
                    }
                }
                thisBibInfo.Add_Related_Item(precedingItem);
            }

            // Add the Suceeding Entry (785)
            foreach (MARC_Field thisRecord in record[785])
            {
                Related_Item_Info succeedingItem = new Related_Item_Info();
                succeedingItem.Relationship = Related_Item_Type_Enum.Succeeding;
                if (thisRecord.has_Subfield('t'))
                    succeedingItem.Main_Title.Title = thisRecord['t'];
                if (thisRecord.has_Subfield('x'))
                    succeedingItem.Add_Identifier(thisRecord['x'], "issn");
                if (thisRecord.has_Subfield('z'))
                    succeedingItem.Add_Identifier(thisRecord['z'], "isbn");
                if (thisRecord.has_Subfield('w'))
                {
                    string[] splitter = thisRecord['w'].Split("|".ToCharArray());
                    foreach (string thisSplitter in splitter)
                    {
                        if ((thisSplitter.IndexOf("(DLC)sn") >= 0) || (thisSplitter.IndexOf("(OCoLC)") >= 0))
                        {
                            if (thisSplitter.IndexOf("(DLC)sn") >= 0)
                            {
                                succeedingItem.Add_Identifier(thisSplitter.Replace("(DLC)sn", "").Trim(), "lccn");
                            }
                            if (thisSplitter.IndexOf("(OCoLC)") >= 0)
                            {
                                succeedingItem.Add_Identifier(thisSplitter.Replace("(OCoLC)", "").Trim(), "oclc");
                            }
                        }
                        else
                        {
                            succeedingItem.Add_Identifier(thisSplitter.Trim(), String.Empty);
                        }
                    }
                }
                if (thisRecord.has_Subfield('o'))
                {
                    if (thisRecord['o'].IndexOf("(SobekCM)") >= 0)
                        succeedingItem.SobekCM_ID = thisRecord['o'].Replace("(SobekCM)", "").Trim();
                }
                thisBibInfo.Add_Related_Item(succeedingItem);
            }

            // Add the Other Relationship Entry (787)
            foreach (MARC_Field thisRecord in record[787])
            {
                Related_Item_Info otherRelationItem = new Related_Item_Info();
                otherRelationItem.Relationship = Related_Item_Type_Enum.UNKNOWN;
                if (thisRecord.has_Subfield('t'))
                    otherRelationItem.Main_Title.Title = thisRecord['t'];
                if (thisRecord.has_Subfield('x'))
                    otherRelationItem.Add_Identifier(thisRecord['x'], "issn");
                if (thisRecord.has_Subfield('z'))
                    otherRelationItem.Add_Identifier(thisRecord['z'], "isbn");
                if (thisRecord.has_Subfield('w'))
                {
                    string[] splitter = thisRecord['w'].Split("|".ToCharArray());
                    foreach (string thisSplitter in splitter)
                    {
                        if ((thisSplitter.IndexOf("(DLC)sn") >= 0) || (thisSplitter.IndexOf("(OCoLC)") >= 0))
                        {
                            if (thisSplitter.IndexOf("(DLC)sn") >= 0)
                            {
                                otherRelationItem.Add_Identifier(thisSplitter.Replace("(DLC)sn", "").Trim(), "lccn");
                            }
                            if (thisSplitter.IndexOf("(OCoLC)") >= 0)
                            {
                                otherRelationItem.Add_Identifier(thisSplitter.Replace("(OCoLC)", "").Trim(), "oclc");
                            }
                        }
                        else
                        {
                            otherRelationItem.Add_Identifier(thisSplitter.Trim(), String.Empty);
                        }
                    }
                }
                if (thisRecord.has_Subfield('o'))
                {
                    if (thisRecord['o'].IndexOf("(SobekCM)") >= 0)
                        otherRelationItem.SobekCM_ID = thisRecord['o'].Replace("(SobekCM)", "").Trim();
                }
                thisBibInfo.Add_Related_Item(otherRelationItem);
            }

            // Get the type of resource ( Leader/006, Leader/007, Serial 008/021 )
            string marc_type = String.Empty;
            switch (record.Leader[6])
            {
                case 'a':
                case 't':
                    thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Book;
                    marc_type = "BKS";
                    break;

                case 'e':
                case 'f':
                    thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Map;
                    marc_type = "MAP";
                    break;

                case 'c':
                case 'd':
                    thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Book;
                    marc_type = "BKS";
                    break;

                case 'i':
                case 'j':
                    thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Audio;
                    marc_type = "REC";
                    break;

                case 'k':
                    thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Photograph;
                    marc_type = "VIS";
                    break;

                case 'g':
                    thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Video;
                    marc_type = "VIS";
                    break;

                case 'r':
                    thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Artifact;
                    marc_type = "VIS";
                    break;

                case 'm':
                    thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Archival;
                    marc_type = "COM";
                    break;

                case 'p':
                    thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Archival;
                    marc_type = "MIX";
                    break;

                case 'o':
                    marc_type = "VIS";
                    thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Archival;
                    break;
            }
            if (record.Leader[7] == 'c')
                thisBibInfo.Type.Collection = true;
            if (record.Leader[7] == 's')
            {
                thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Serial;

                if (field_008.Length > 22)
                {
                    if (field_008[21] == 'n')
                        thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Newspaper;
                }
                marc_type = "CNR";
            }
            thisBibInfo.EncodingLevel = record.Leader[17].ToString().Replace("^", "#").Replace(" ", "#");

            if (field_008.Length > 35)
            {
                if ((marc_type == "BKS") || (marc_type == "CNR") || (marc_type == "MAP") || (marc_type == "COM") || (marc_type == "VIS"))
                {
                    switch (field_008[28])
                    {
                        case 'c':
                            thisBibInfo.Add_Genre("multilocal government publication", "marcgt");
                            break;

                        case 'f':
                            thisBibInfo.Add_Genre("federal government publication", "marcgt");
                            break;

                        case 'i':
                            thisBibInfo.Add_Genre("international intergovernmental publication", "marcgt");
                            break;

                        case 'l':
                            thisBibInfo.Add_Genre("local government publication", "marcgt");
                            break;

                        case 'm':
                            thisBibInfo.Add_Genre("multistate government publication", "marcgt");
                            break;

                        case 'o':
                            thisBibInfo.Add_Genre("government publication", "marcgt");
                            break;

                        case 's':
                            thisBibInfo.Add_Genre("government publication (state, provincial, terriorial, dependent)", "marcgt");
                            break;

                        case 'a':
                            thisBibInfo.Add_Genre("government publication (autonomous or semiautonomous component)", "marcgt");
                            break;
                    }
                }

                if ((marc_type == "BKS") || (marc_type == "CNR"))
                {
                    string nature_of_contents = field_008.Substring(24, 4);
                    if (nature_of_contents.IndexOf("a") >= 0)
                        thisBibInfo.Add_Genre("abstract or summary", "marcgt");
                    if (nature_of_contents.IndexOf("b") >= 0)
                        thisBibInfo.Add_Genre("bibliography", "marcgt");
                    if (nature_of_contents.IndexOf("c") >= 0)
                        thisBibInfo.Add_Genre("catalog", "marcgt");
                    if (nature_of_contents.IndexOf("d") >= 0)
                        thisBibInfo.Add_Genre("dictionary", "marcgt");
                    if (nature_of_contents.IndexOf("r") >= 0)
                        thisBibInfo.Add_Genre("directory", "marcgt");
                    if (nature_of_contents.IndexOf("k") >= 0)
                        thisBibInfo.Add_Genre("discography", "marcgt");
                    if (nature_of_contents.IndexOf("e") >= 0)
                        thisBibInfo.Add_Genre("encyclopedia", "marcgt");
                    if (nature_of_contents.IndexOf("q") >= 0)
                        thisBibInfo.Add_Genre("filmography", "marcgt");
                    if (nature_of_contents.IndexOf("f") >= 0)
                        thisBibInfo.Add_Genre("handbook", "marcgt");
                    if (nature_of_contents.IndexOf("i") >= 0)
                        thisBibInfo.Add_Genre("index", "marcgt");
                    if (nature_of_contents.IndexOf("w") >= 0)
                        thisBibInfo.Add_Genre("law report or digest", "marcgt");
                    if (nature_of_contents.IndexOf("g") >= 0)
                        thisBibInfo.Add_Genre("legal article", "marcgt");
                    if (nature_of_contents.IndexOf("v") >= 0)
                        thisBibInfo.Add_Genre("legal case and case notes", "marcgt");
                    if (nature_of_contents.IndexOf("l") >= 0)
                        thisBibInfo.Add_Genre("legislation", "marcgt");
                    if (nature_of_contents.IndexOf("j") >= 0)
                        thisBibInfo.Add_Genre("patent", "marcgt");
                    if (nature_of_contents.IndexOf("p") >= 0)
                        thisBibInfo.Add_Genre("programmed text", "marcgt");
                    if (nature_of_contents.IndexOf("o") >= 0)
                        thisBibInfo.Add_Genre("review", "marcgt");
                    if (nature_of_contents.IndexOf("s") >= 0)
                        thisBibInfo.Add_Genre("statistics", "marcgt");
                    if (nature_of_contents.IndexOf("n") >= 0)
                        thisBibInfo.Add_Genre("survey of literature", "marcgt");
                    if (nature_of_contents.IndexOf("t") >= 0)
                        thisBibInfo.Add_Genre("technical report", "marcgt");
                    if (nature_of_contents.IndexOf("m") >= 0)
                        thisBibInfo.Add_Genre("theses", "marcgt");
                    if (nature_of_contents.IndexOf("z") >= 0)
                        thisBibInfo.Add_Genre("treaty", "marcgt");
                    if (nature_of_contents.IndexOf("2") >= 0)
                        thisBibInfo.Add_Genre("offprint", "marcgt");
                    if (nature_of_contents.IndexOf("y") >= 0)
                        thisBibInfo.Add_Genre("yearbook", "marcgt");
                    if (nature_of_contents.IndexOf("5") >= 0)
                        thisBibInfo.Add_Genre("calendar", "marcgt");
                    if (nature_of_contents.IndexOf("6") >= 0)
                        thisBibInfo.Add_Genre("comic/graphic novel", "marcgt");

                    if (field_008[29] == '1')
                        thisBibInfo.Add_Genre("conference publication", "marcgt");
                }

                if (marc_type == "CNR")
                {
                    if (field_008[21] == 'd')
                        thisBibInfo.Add_Genre("database", "marcgt");
                    if (field_008[21] == 'l')
                        thisBibInfo.Add_Genre("loose-leaf", "marcgt");
                    if (field_008[21] == 'n')
                        thisBibInfo.Add_Genre("newspaper", "marcgt");
                    if (field_008[21] == 'p')
                        thisBibInfo.Add_Genre("periodical", "marcgt");
                    if (field_008[21] == 's')
                        thisBibInfo.Add_Genre("series", "marcgt");
                    if (field_008[21] == 'w')
                        thisBibInfo.Add_Genre("web site", "marcgt");

                    // Get the frequency
                    switch (field_008[18])
                    {
                        case 'a':
                            thisBibInfo.Origin_Info.Add_Frequency("annual", "marcfrequency");
                            break;

                        case 'b':
                            thisBibInfo.Origin_Info.Add_Frequency("bimonthly", "marcfrequency");
                            break;

                        case 'c':
                            thisBibInfo.Origin_Info.Add_Frequency("semiweekly", "marcfrequency");
                            break;

                        case 'd':
                            thisBibInfo.Origin_Info.Add_Frequency("daily", "marcfrequency");
                            break;

                        case 'e':
                            thisBibInfo.Origin_Info.Add_Frequency("biweekly", "marcfrequency");
                            break;

                        case 'f':
                            thisBibInfo.Origin_Info.Add_Frequency("semiannual", "marcfrequency");
                            break;

                        case 'g':
                            thisBibInfo.Origin_Info.Add_Frequency("biennial", "marcfrequency");
                            break;

                        case 'h':
                            thisBibInfo.Origin_Info.Add_Frequency("triennial", "marcfrequency");
                            break;

                        case 'i':
                            thisBibInfo.Origin_Info.Add_Frequency("three times a week", "marcfrequency");
                            break;

                        case 'j':
                            thisBibInfo.Origin_Info.Add_Frequency("three times a month", "marcfrequency");
                            break;

                        case 'k':
                            thisBibInfo.Origin_Info.Add_Frequency("continuously updated", "marcfrequency");
                            break;

                        case 'm':
                            thisBibInfo.Origin_Info.Add_Frequency("monthly", "marcfrequency");
                            break;

                        case 'q':
                            thisBibInfo.Origin_Info.Add_Frequency("quarterly", "marcfrequency");
                            break;

                        case 's':
                            thisBibInfo.Origin_Info.Add_Frequency("semimonthly", "marcfrequency");
                            break;

                        case 't':
                            thisBibInfo.Origin_Info.Add_Frequency("three times a year", "marcfrequency");
                            break;

                        case 'w':
                            thisBibInfo.Origin_Info.Add_Frequency("weekly", "marcfrequency");
                            break;

                        case 'z':
                            thisBibInfo.Origin_Info.Add_Frequency("other", "marcfrequency");
                            break;
                    }

                    // Get the regularity
                    switch (field_008[19])
                    {
                        case 'n':
                            thisBibInfo.Origin_Info.Add_Frequency("normalized irregular", "marcfrequency");
                            break;

                        case 'r':
                            thisBibInfo.Origin_Info.Add_Frequency("regular", "marcfrequency");
                            break;

                        case 'x':
                            thisBibInfo.Origin_Info.Add_Frequency("completely irregular", "marcfrequency");
                            break;
                    }
                }

                if (marc_type == "MAP")
                {
                    // Get the form of item
                    if (field_008[25] == 'e')
                        thisBibInfo.Add_Genre("atlas", "marcgt");
                    if (field_008[25] == 'd')
                        thisBibInfo.Add_Genre("globe", "marcgt");
                    if (field_008[25] == 'a')
                        thisBibInfo.Add_Genre("single map", "marcgt");
                    if (field_008[25] == 'b')
                        thisBibInfo.Add_Genre("map series", "marcgt");
                    if (field_008[25] == 'c')
                        thisBibInfo.Add_Genre("map serial", "marcgt");

                    // Get the projection, if there is one
                    if ((field_008.Substring(22, 2) != "  ") && (field_008.Substring(22, 2) != "||") && (field_008.Substring(22, 2) != "^^") && (field_008.Substring(22, 2) != "||"))
                    {
                        Subject_Info_Cartographics cartographicsSubject = new Subject_Info_Cartographics();
                        cartographicsSubject.ID = "SUBJ008";
                        cartographicsSubject.Projection = field_008.Substring(22, 2);
                        thisBibInfo.Add_Subject(cartographicsSubject);
                    }

                    // Get whether this is indexed
                    if (field_008[31] == '1')
                    {
                        thisBibInfo.Add_Genre("indexed", "marcgt");
                    }
                }

                if (marc_type == "REC")
                {
                    string nature_of_recording = field_008.Substring(30, 2);
                    if (nature_of_recording.IndexOf("a") >= 0)
                        thisBibInfo.Add_Genre("autobiography", "marcgt");
                    if (nature_of_recording.IndexOf("b") >= 0)
                        thisBibInfo.Add_Genre("biography", "marcgt");
                    if (nature_of_recording.IndexOf("c") >= 0)
                        thisBibInfo.Add_Genre("conference publication", "marcgt");
                    if (nature_of_recording.IndexOf("d") >= 0)
                        thisBibInfo.Add_Genre("drama", "marcgt");
                    if (nature_of_recording.IndexOf("e") >= 0)
                        thisBibInfo.Add_Genre("essay", "marcgt");
                    if (nature_of_recording.IndexOf("f") >= 0)
                        thisBibInfo.Add_Genre("fiction", "marcgt");
                    if (nature_of_recording.IndexOf("o") >= 0)
                        thisBibInfo.Add_Genre("folktale", "marcgt");
                    if (nature_of_recording.IndexOf("k") >= 0)
                        thisBibInfo.Add_Genre("humor, satire", "marcgt");
                    if (nature_of_recording.IndexOf("i") >= 0)
                        thisBibInfo.Add_Genre("instruction", "marcgt");
                    if (nature_of_recording.IndexOf("t") >= 0)
                        thisBibInfo.Add_Genre("interview", "marcgt");
                    if (nature_of_recording.IndexOf("j") >= 0)
                        thisBibInfo.Add_Genre("language instruction", "marcgt");
                    if (nature_of_recording.IndexOf("m") >= 0)
                        thisBibInfo.Add_Genre("memoir", "marcgt");
                    if (nature_of_recording.IndexOf("p") >= 0)
                        thisBibInfo.Add_Genre("poetry", "marcgt");
                    if (nature_of_recording.IndexOf("r") >= 0)
                        thisBibInfo.Add_Genre("rehearsal", "marcgt");
                    if (nature_of_recording.IndexOf("g") >= 0)
                        thisBibInfo.Add_Genre("reporting", "marcgt");
                    if (nature_of_recording.IndexOf("s") >= 0)
                        thisBibInfo.Add_Genre("sound", "marcgt");
                    if (nature_of_recording.IndexOf("l") >= 0)
                        thisBibInfo.Add_Genre("speech", "marcgt");
                }

                if (marc_type == "COM")
                {
                    switch (field_008[26])
                    {
                        case 'e':
                            thisBibInfo.Add_Genre("database", "marcgt");
                            break;

                        case 'f':
                            thisBibInfo.Add_Genre("font", "marcgt");
                            break;

                        case 'g':
                            thisBibInfo.Add_Genre("game", "marcgt");
                            break;

                        case 'a':
                            thisBibInfo.Add_Genre("numeric data", "marcgt");
                            break;

                        case 'h':
                            thisBibInfo.Add_Genre("sound", "marcgt");
                            break;
                    }
                }

                if (marc_type == "VIS")
                {
                    switch (field_008[33])
                    {
                        case 'a':
                            thisBibInfo.Add_Genre("art original", "marcgt");
                            break;

                        case 'c':
                            thisBibInfo.Add_Genre("art reproduction", "marcgt");
                            break;

                        case 'n':
                            thisBibInfo.Add_Genre("chart", "marcgt");
                            break;

                        case 'd':
                            thisBibInfo.Add_Genre("diorama", "marcgt");
                            break;

                        case 'f':
                            thisBibInfo.Add_Genre("filmstrip", "marcgt");
                            break;

                        case 'o':
                            thisBibInfo.Add_Genre("flash card", "marcgt");
                            break;

                        case 'k':
                            thisBibInfo.Add_Genre("graphic", "marcgt");
                            break;

                        case 'b':
                            thisBibInfo.Add_Genre("kit", "marcgt");
                            break;

                        case 'p':
                            thisBibInfo.Add_Genre("microscope slide", "marcgt");
                            break;

                        case 'q':
                            thisBibInfo.Add_Genre("model", "marcgt");
                            break;

                        case 'm':
                            thisBibInfo.Add_Genre("motion picture", "marcgt");
                            break;

                        case 'i':
                            thisBibInfo.Add_Genre("picture", "marcgt");
                            break;

                        case 'r':
                            thisBibInfo.Add_Genre("realia", "marcgt");
                            break;

                        case 's':
                            thisBibInfo.Add_Genre("slide", "marcgt");
                            break;

                        case 'l':
                            thisBibInfo.Add_Genre("technical drawing", "marcgt");
                            break;

                        case 'w':
                            thisBibInfo.Add_Genre("toy", "marcgt");
                            break;

                        case 't':
                            thisBibInfo.Add_Genre("transparency", "marcgt");
                            break;

                        case 'v':
                            thisBibInfo.Add_Genre("video recording", "marcgt");
                            break;
                    }
                }

                if (marc_type == "BKS")
                {
                    switch (field_008[34])
                    {
                        case 'a':
                            thisBibInfo.Add_Genre("autobiography", "marcgt");
                            break;

                        case 'b':
                            thisBibInfo.Add_Genre("individual biography", "marcgt");
                            break;

                        case 'c':
                            thisBibInfo.Add_Genre("collective biography", "marcgt");
                            break;
                    }

                    switch (field_008[33])
                    {
                        case 'a':
                            thisBibInfo.Add_Genre("comic strip", "marcgt");
                            break;

                        case 'd':
                            thisBibInfo.Add_Genre("drama", "marcgt");
                            break;

                        case 'e':
                            thisBibInfo.Add_Genre("essay", "marcgt");
                            break;

                        case 'h':
                            thisBibInfo.Add_Genre("humor, satire", "marcgt");
                            break;

                        case 'i':
                            thisBibInfo.Add_Genre("letter", "marcgt");
                            break;

                        case 'p':
                            thisBibInfo.Add_Genre("poetry", "marcgt");
                            break;

                        case 'f':
                            thisBibInfo.Add_Genre("novel", "marcgt");
                            break;

                        case 'j':
                            thisBibInfo.Add_Genre("short story", "marcgt");
                            break;

                        case 's':
                            thisBibInfo.Add_Genre("speech", "marcgt");
                            break;

                        case '0':
                            thisBibInfo.Add_Genre("non-fiction", "marcgt");
                            break;

                        case '1':
                            thisBibInfo.Add_Genre("fiction", "marcgt");
                            break;
                    }

                    if ((field_008[30] == 'h') || (field_008[31] == 'h'))
                    {
                        thisBibInfo.Add_Genre("history", "marcgt");
                    }

                    if (field_008[30] == '1')
                    {
                        thisBibInfo.Add_Genre("festschrift", "marcgt");
                    }
                }
            }

            // Look for target audience (521)
            foreach (MARC_Field thisRecord in record[521])
            {
                if (thisRecord.has_Subfield('a'))
                {
                    if (thisRecord.has_Subfield('b'))
                    {
                        thisBibInfo.Add_Target_Audience(thisRecord['a'].Replace("[", "(").Replace("]", ")") + " [ " + thisRecord['b'].Replace("[", "(").Replace("]", ")") + " ]");
                    }
                    else
                    {
                        thisBibInfo.Add_Target_Audience(thisRecord['a'].Replace("[", "(").Replace("]", ")"));
                    }
                }
            }

            // Look for target audince (008/22)
            if ((marc_type == "BKS") || (marc_type == "COM") || (marc_type == "REC") || (marc_type == "SCO") || (marc_type == "VIS"))
            {
                if (field_008.Length > 22)
                {
                    switch (field_008[22])
                    {
                        case 'd':
                            thisBibInfo.Add_Target_Audience("adolescent", "marctarget");
                            break;

                        case 'e':
                            thisBibInfo.Add_Target_Audience("adult", "marctarget");
                            break;

                        case 'g':
                            thisBibInfo.Add_Target_Audience("general", "marctarget");
                            break;

                        case 'b':
                            thisBibInfo.Add_Target_Audience("primary", "marctarget");
                            break;

                        case 'c':
                            thisBibInfo.Add_Target_Audience("pre-adolescent", "marctarget");
                            break;

                        case 'j':
                            thisBibInfo.Add_Target_Audience("juvenile", "marctarget");
                            break;

                        case 'a':
                            thisBibInfo.Add_Target_Audience("preschool", "marctarget");
                            break;

                        case 'f':
                            thisBibInfo.Add_Target_Audience("specialized", "marctarget");
                            break;
                    }
                }
            }

            // Get any project codes ( 852 )
            if ((package != null) && (package.Behaviors.Aggregation_Count == 0))
            {
                foreach (MARC_Field thisRecord in record[852])
                {
                    if ((thisRecord.Indicators.Trim().Length == 0) && (thisRecord.has_Subfield('b')))
                    {
                        string allCodes = thisRecord['b'];
                        string[] splitAllCodes = allCodes.Split("|;".ToCharArray());
                        foreach (string splitCode in splitAllCodes)
                        {
                            package.Behaviors.Add_Aggregation(splitCode.Trim());
                        }
                    }
                }
            }
        }
        /// <summary> Reads the MODS-compliant section of XML and stores the data in the provided digital resource </summary>
        /// <param name="R"> XmlTextReader from which to read the MODS data </param>
        /// <param name="ThisBibInfo"> Digital resource object to save the data to </param>
        /// <param name="Return_Item"> Return item to have the MODS information populated </param>
        public static void Read_MODS_Info(XmlReader R, Bibliographic_Info ThisBibInfo, SobekCM_Item Return_Item)
        {
            while (R.Read())
            {
                if ((R.NodeType == XmlNodeType.EndElement) && ((R.Name == "METS:mdWrap") || (R.Name == "mdWrap") || (R.Name == "mods")))
                    return;

                if (R.NodeType == XmlNodeType.Element)
                {
                    switch (R.Name)
                    {
                        case "mods:abstract":
                        case "abstract":
                            Abstract_Info thisAbstract = new Abstract_Info();
                            if (R.MoveToAttribute("ID"))
                                thisAbstract.ID = R.Value;
                            if (R.MoveToAttribute("type"))
                                thisAbstract.Type = R.Value;
                            if (R.MoveToAttribute("displayLabel"))
                                thisAbstract.Display_Label = R.Value;
                            if (R.MoveToAttribute("lang"))
                                thisAbstract.Language = R.Value;
                            R.Read();
                            if (R.NodeType == XmlNodeType.Text)
                            {
                                thisAbstract.Abstract_Text = R.Value;
                                ThisBibInfo.Add_Abstract(thisAbstract);
                            }
                            break;

                        case "mods:accessCondition":
                        case "accessCondition":
                            if (R.MoveToAttribute("ID"))
                                ThisBibInfo.Access_Condition.ID = R.Value;
                            if (R.MoveToAttribute("type"))
                                ThisBibInfo.Access_Condition.Type = R.Value;
                            if (R.MoveToAttribute("displayLabel"))
                                ThisBibInfo.Access_Condition.Display_Label = R.Value;
                            if (R.MoveToAttribute("lang"))
                                ThisBibInfo.Access_Condition.Language = R.Value;
                            R.Read();
                            if (R.NodeType == XmlNodeType.Text)
                            {
                                ThisBibInfo.Access_Condition.Text = R.Value;
                            }
                            break;

                        case "mods:classification":
                        case "classification":
                            Classification_Info thisClassification = new Classification_Info();
                            if (R.MoveToAttribute("edition"))
                                thisClassification.Edition = R.Value;
                            if (R.MoveToAttribute("authority"))
                                thisClassification.Authority = R.Value;
                            if (R.MoveToAttribute("displayLabel"))
                                thisClassification.Display_Label = R.Value;
                            R.Read();
                            if (R.NodeType == XmlNodeType.Text)
                            {
                                thisClassification.Classification = R.Value;
                                ThisBibInfo.Add_Classification(thisClassification);
                            }
                            break;

                        case "mods:identifier":
                        case "identifier":
                            Identifier_Info thisIdentifier = new Identifier_Info();
                            if (R.MoveToAttribute("type"))
                                thisIdentifier.Type = R.Value;
                            if (R.MoveToAttribute("displayLabel"))
                                thisIdentifier.Display_Label = R.Value;
                            R.Read();
                            if (R.NodeType == XmlNodeType.Text)
                            {
                                thisIdentifier.Identifier = R.Value;
                                ThisBibInfo.Add_Identifier(thisIdentifier);
                            }
                            break;

                        case "mods:genre":
                        case "genre":
                            Genre_Info thisGenre = new Genre_Info();
                            if (R.MoveToAttribute("ID"))
                                thisGenre.ID = R.Value;
                            if (R.MoveToAttribute("authority"))
                                thisGenre.Authority = R.Value;
                            if (R.MoveToAttribute("lang"))
                                thisGenre.Language = R.Value;
                            R.Read();
                            if (R.NodeType == XmlNodeType.Text)
                            {
                                thisGenre.Genre_Term = R.Value;
                                ThisBibInfo.Add_Genre(thisGenre);
                            }
                            break;

                        case "mods:language":
                        case "language":
                            string language_text = String.Empty;
                            string language_rfc_code = String.Empty;
                            string language_iso_code = String.Empty;
                            string language_id = String.Empty;
                            if (R.MoveToAttribute("ID"))
                                language_id = R.Value;
                            while (R.Read())
                            {
                                if ((R.NodeType == XmlNodeType.Element) && ((R.Name == "mods:languageTerm") || (R.Name == "languageTerm")))
                                {
                                    if (R.MoveToAttribute("type"))
                                    {
                                        switch (R.Value)
                                        {
                                            case "code":
                                                if (R.MoveToAttribute("authority"))
                                                {
                                                    if (R.Value == "rfc3066")
                                                    {
                                                        R.Read();
                                                        if (R.NodeType == XmlNodeType.Text)
                                                        {
                                                            language_rfc_code = R.Value;
                                                        }
                                                    }
                                                    else if (R.Value == "iso639-2b")
                                                    {
                                                        R.Read();
                                                        if (R.NodeType == XmlNodeType.Text)
                                                        {
                                                            language_iso_code = R.Value;
                                                        }
                                                    }
                                                }
                                                break;

                                            case "text":
                                                R.Read();
                                                if (R.NodeType == XmlNodeType.Text)
                                                {
                                                    language_text = R.Value;
                                                }
                                                // Quick check for a change we started in 2010
                                                if (language_text == "governmental publication")
                                                    language_text = "government publication";
                                                break;

                                            default:
                                                R.Read();
                                                if (R.NodeType == XmlNodeType.Text)
                                                {
                                                    language_text = R.Value;
                                                }
                                                break;
                                        }
                                    }
                                    else
                                    {
                                        R.Read();
                                        if (R.NodeType == XmlNodeType.Text)
                                        {
                                            language_text = R.Value;
                                        }
                                    }
                                }

                                if ((R.NodeType == XmlNodeType.EndElement) && ((R.Name == "mods:language") || (R.Name == "language")))
                                {
                                    break;
                                }
                            }

                            if ((language_text.Length > 0) || (language_rfc_code.Length > 0) || (language_iso_code.Length > 0))
                            {
                                ThisBibInfo.Add_Language(language_text, language_iso_code, language_rfc_code);
                            }
                            break;

                        case "mods:location":
                        case "location":
                            while (R.Read())
                            {
                                if ((R.NodeType == XmlNodeType.EndElement) && ((R.Name == "mods:location") || (R.Name == "location")))
                                    break;

                                if (R.NodeType == XmlNodeType.Element)
                                {
                                    if ((R.Name == "mods:physicalLocation") || (R.Name == "physicalLocation"))
                                    {
                                        if (R.MoveToAttribute("type"))
                                        {
                                            if (R.Value == "code")
                                            {
                                                R.Read();
                                                if (R.NodeType == XmlNodeType.Text)
                                                {
                                                    ThisBibInfo.Location.Holding_Code = R.Value;
                                                }
                                            }
                                        }
                                        else
                                        {
                                            R.Read();
                                            if (R.NodeType == XmlNodeType.Text)
                                            {
                                                ThisBibInfo.Location.Holding_Name = R.Value;
                                            }
                                        }
                                    }
                                    if ((R.Name == "mods:url") || (R.Name == "url"))
                                    {
                                        // TEST
                                        if (R.MoveToAttribute("access"))
                                        {
                                            if (R.Value == "object in context")
                                            {
                                                R.Read();
                                                if (R.NodeType == XmlNodeType.Text)
                                                {
                                                    ThisBibInfo.Location.PURL = R.Value;
                                                }
                                            }
                                        }
                                        else
                                        {
                                            string url_displayLabel = R.GetAttribute("displayLabel");
                                            string url_note = R.GetAttribute("note");
                                            R.Read();
                                            if (R.NodeType == XmlNodeType.Text)
                                            {
                                                if ((url_displayLabel != null) && (url_displayLabel == "Finding Guide"))
                                                {
                                                    if (url_note != null)
                                                    {
                                                        ThisBibInfo.Location.EAD_Name = url_note;
                                                    }
                                                    ThisBibInfo.Location.EAD_URL = R.Value;
                                                }
                                                else
                                                {
                                                    if (url_displayLabel != null)
                                                    {
                                                        ThisBibInfo.Location.Other_URL_Display_Label = url_displayLabel;
                                                    }

                                                    if (url_note != null)
                                                    {
                                                        ThisBibInfo.Location.Other_URL_Note = url_note;
                                                    }
                                                    ThisBibInfo.Location.Other_URL = R.Value;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            break;

                        case "mods:name":
                        case "name":
                            Name_Info tempNewName = read_name_object(R);
                            if (tempNewName.Main_Entity)
                                ThisBibInfo.Main_Entity_Name = tempNewName;
                            else
                            {
                                bool donor = false;
                                foreach (Name_Info_Role role in tempNewName.Roles)
                                {
                                    if ((role.Role == "donor") || (role.Role == "honoree") || (role.Role == "endowment") || (role.Role == "collection"))
                                    {
                                        donor = true;
                                        break;
                                    }
                                }
                                if (donor)
                                {
                                    ThisBibInfo.Donor = tempNewName;
                                }
                                else
                                {
                                    ThisBibInfo.Add_Named_Entity(tempNewName);
                                }
                            }
                            break;

                        case "mods:note":
                        case "note":
                            Note_Info newNote = new Note_Info();
                            if (R.MoveToAttribute("ID"))
                                newNote.ID = R.Value;
                            if (R.MoveToAttribute("type"))
                                newNote.Note_Type_String = R.Value;
                            if (R.MoveToAttribute("displayLabel"))
                                newNote.Display_Label = R.Value;
                            R.Read();
                            if (R.NodeType == XmlNodeType.Text)
                            {
                                newNote.Note = R.Value;
                                ThisBibInfo.Add_Note(newNote);
                            }
                            break;

                        case "mods:Origin_Info":
                        case "Origin_Info":
                        case "mods:originInfo":
                        case "originInfo":
                            while (R.Read())
                            {
                                if ((R.NodeType == XmlNodeType.EndElement) && ((R.Name == "mods:Origin_Info") || (R.Name == "Origin_Info") || (R.Name == "mods:originInfo") || (R.Name == "originInfo")))
                                    break;

                                if (R.NodeType == XmlNodeType.Element)
                                {
                                    switch (R.Name)
                                    {
                                        case "mods:publisher":
                                        case "publisher":
                                            R.Read();
                                            if (R.NodeType == XmlNodeType.Text)
                                            {
                                                ThisBibInfo.Origin_Info.Add_Publisher(R.Value);
                                                ThisBibInfo.Add_Publisher(R.Value);
                                            }
                                            break;

                                        case "mods:place":
                                        case "place":
                                            string place_text = String.Empty;
                                            string place_marc = String.Empty;
                                            string place_iso = String.Empty;
                                            while ((R.Read()) && (!(((R.Name == "mods:place") || (R.Name == "place")) && (R.NodeType == XmlNodeType.EndElement))))
                                            {
                                                if ((R.NodeType == XmlNodeType.Element) && ((R.Name == "mods:placeTerm") || (R.Name == "placeTerm")))
                                                {
                                                    if ((R.MoveToAttribute("type")) && (R.Value == "code"))
                                                    {
                                                        if (R.MoveToAttribute("authority"))
                                                        {
                                                            switch (R.Value)
                                                            {
                                                                case "marccountry":
                                                                    R.Read();
                                                                    if (R.NodeType == XmlNodeType.Text)
                                                                    {
                                                                        place_marc = R.Value;
                                                                    }
                                                                    break;

                                                                case "iso3166":
                                                                    R.Read();
                                                                    if (R.NodeType == XmlNodeType.Text)
                                                                    {
                                                                        place_iso = R.Value;
                                                                    }
                                                                    break;
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        R.Read();
                                                        if (R.NodeType == XmlNodeType.Text)
                                                        {
                                                            place_text = R.Value;
                                                        }
                                                    }
                                                }
                                            }
                                            if ((place_text.Length > 0) || (place_marc.Length > 0) || (place_iso.Length > 0))
                                            {
                                                ThisBibInfo.Origin_Info.Add_Place(place_text, place_marc, place_iso);
                                            }
                                            break;

                                        case "mods:dateIssued":
                                        case "dateIssued":
                                            if ((R.MoveToAttribute("encoding")) && (R.Value == "marc"))
                                            {
                                                if (R.MoveToAttribute("point"))
                                                {
                                                    if (R.Value == "start")
                                                    {
                                                        R.Read();
                                                        if (R.NodeType == XmlNodeType.Text)
                                                        {
                                                            ThisBibInfo.Origin_Info.MARC_DateIssued_Start = R.Value;
                                                        }
                                                    }
                                                    else if (R.Value == "end")
                                                    {
                                                        R.Read();
                                                        if (R.NodeType == XmlNodeType.Text)
                                                        {
                                                            ThisBibInfo.Origin_Info.MARC_DateIssued_End = R.Value;
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    R.Read();
                                                    if (R.NodeType == XmlNodeType.Text)
                                                    {
                                                        ThisBibInfo.Origin_Info.MARC_DateIssued = R.Value;
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                R.Read();
                                                if (R.NodeType == XmlNodeType.Text)
                                                {
                                                    ThisBibInfo.Origin_Info.Date_Issued = R.Value;
                                                }
                                            }
                                            break;

                                        case "mods:dateCreated":
                                        case "dateCreated":
                                            R.Read();
                                            if (R.NodeType == XmlNodeType.Text)
                                            {
                                                ThisBibInfo.Origin_Info.Date_Created = R.Value;
                                            }
                                            break;

                                        case "mods:copyrightDate":
                                        case "copyrightDate":
                                            R.Read();
                                            if (R.NodeType == XmlNodeType.Text)
                                            {
                                                ThisBibInfo.Origin_Info.Date_Copyrighted = R.Value;
                                            }
                                            break;

                                        case "mods:dateOther":
                                        case "dateOther":
                                            string dateType = null;
                                            bool keyDate = false;
                                            if (R.MoveToAttribute("type")) dateType = R.Value;
                                            if ((R.MoveToAttribute("keyDate")) && (R.Value == "yes")) keyDate = true;

                                            // Read the date main node
                                            R.Read();
                                            if (R.NodeType == XmlNodeType.Text)
                                            {
                                                // Keeping the special spot for the reprint date still
                                                if ((!String.IsNullOrWhiteSpace(dateType)) && (dateType == "reprint"))
                                                {
                                                    ThisBibInfo.Origin_Info.Date_Reprinted = R.Value;
                                                }
                                                else
                                                {
                                                    ThisBibInfo.Origin_Info.Add_Date_Other(R.Value, dateType).KeyDate = keyDate;
                                                }
                                            }
                                            break;

                                        case "mods:edition":
                                        case "edition":
                                            R.Read();
                                            if (R.NodeType == XmlNodeType.Text)
                                            {
                                                ThisBibInfo.Origin_Info.Edition = R.Value;
                                            }
                                            break;

                                        case "mods:frequency":
                                        case "frequency":
                                            string freq_authority = String.Empty;
                                            if (R.MoveToAttribute("authority"))
                                                freq_authority = R.Value;
                                            R.Read();
                                            if (R.NodeType == XmlNodeType.Text)
                                            {
                                                ThisBibInfo.Origin_Info.Add_Frequency(R.Value, freq_authority);
                                            }
                                            break;

                                        case "mods:issuance":
                                        case "issuance":
                                            R.Read();
                                            if (R.NodeType == XmlNodeType.Text)
                                            {
                                                ThisBibInfo.Origin_Info.Add_Issuance(R.Value);
                                            }
                                            break;
                                    }
                                }
                            }

                            break;

                        case "mods:physicalDescription":
                        case "physicalDescription":
                            read_physical_description(R, ThisBibInfo.Original_Description);
                            break;

                        case "mods:recordInfo":
                        case "recordInfo":
                            while (R.Read())
                            {
                                if ((R.NodeType == XmlNodeType.EndElement) && ((R.Name == "mods:recordInfo") || (R.Name == "recordInfo")))
                                {
                                    break;
                                }

                                if (R.NodeType == XmlNodeType.Element)
                                {
                                    switch (R.Name)
                                    {
                                        case "mods:recordCreationDate":
                                        case "recordCreationDate":
                                            if ((R.MoveToAttribute("encoding")) && (R.Value == "marc"))
                                            {
                                                R.Read();
                                                ThisBibInfo.Record.MARC_Creation_Date = R.Value;
                                            }
                                            break;

                                        case "mods:recordIdentifier":
                                        case "recordIdentifier":
                                            string source = String.Empty;
                                            if (R.MoveToAttribute("source"))
                                            {
                                                ThisBibInfo.Record.Main_Record_Identifier.Type = R.Value;
                                            }
                                            R.Read();
                                            ThisBibInfo.Record.Main_Record_Identifier.Identifier = R.Value;
                                            break;

                                        case "mods:recordOrigin":
                                        case "recordOrigin":
                                            R.Read();
                                            ThisBibInfo.Record.Record_Origin = R.Value;
                                            break;

                                        case "mods:descriptionStandard":
                                        case "descriptionStandard":
                                            R.Read();
                                            ThisBibInfo.Record.Description_Standard = R.Value;
                                            break;

                                        case "mods:recordContentSource":
                                        case "recordContentSource":
                                            if (R.MoveToAttribute("authority"))
                                            {
                                                if (R.Value == "marcorg")
                                                {
                                                    R.Read();
                                                    ThisBibInfo.Record.Add_MARC_Record_Content_Sources(R.Value);
                                                }
                                            }
                                            else
                                            {
                                                R.Read();
                                                ThisBibInfo.Source.Statement = R.Value;
                                            }
                                            break;

                                        case "mods:languageOfCataloging":
                                        case "languageOfCataloging":
                                            string cat_language_text = String.Empty;
                                            string cat_language_rfc_code = String.Empty;
                                            string cat_language_iso_code = String.Empty;
                                            string cat_language_id = String.Empty;
                                            while (R.Read())
                                            {
                                                if ((R.NodeType == XmlNodeType.Element) && ((R.Name == "mods:languageTerm") || (R.Name == "languageTerm")))
                                                {
                                                    if (R.MoveToAttribute("ID"))
                                                        cat_language_id = R.Value;

                                                    if (R.MoveToAttribute("type"))
                                                    {
                                                        switch (R.Value)
                                                        {
                                                            case "code":
                                                                if (R.MoveToAttribute("authority"))
                                                                {
                                                                    if (R.Value == "rfc3066")
                                                                    {
                                                                        R.Read();
                                                                        if (R.NodeType == XmlNodeType.Text)
                                                                        {
                                                                            cat_language_rfc_code = R.Value;
                                                                        }
                                                                    }
                                                                    else if (R.Value == "iso639-2b")
                                                                    {
                                                                        R.Read();
                                                                        if (R.NodeType == XmlNodeType.Text)
                                                                        {
                                                                            cat_language_iso_code = R.Value;
                                                                        }
                                                                    }
                                                                }
                                                                break;

                                                            case "text":
                                                                R.Read();
                                                                if (R.NodeType == XmlNodeType.Text)
                                                                {
                                                                    cat_language_text = R.Value;
                                                                }
                                                                break;

                                                            default:
                                                                R.Read();
                                                                if (R.NodeType == XmlNodeType.Text)
                                                                {
                                                                    cat_language_text = R.Value;
                                                                }
                                                                break;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        R.Read();
                                                        if (R.NodeType == XmlNodeType.Text)
                                                        {
                                                            cat_language_text = R.Value;
                                                        }
                                                    }
                                                }

                                                if ((R.NodeType == XmlNodeType.EndElement) && ((R.Name == "mods:languageOfCataloging") || (R.Name == "languageOfCataloging")))
                                                {
                                                    break;
                                                }
                                            }

                                            if ((cat_language_text.Length > 0) || (cat_language_rfc_code.Length > 0) || (cat_language_iso_code.Length > 0))
                                            {
                                                Language_Info newCatLanguage = new Language_Info(cat_language_text, cat_language_iso_code, cat_language_rfc_code);
                                                ThisBibInfo.Record.Add_Catalog_Language(newCatLanguage);
                                            }
                                            break;
                                    }
                                }
                            }
                            break;

                        case "mods:relatedItem":
                        case "relatedItem":
                            string relatedItemType = String.Empty;
                            if (R.MoveToAttribute("type"))
                                relatedItemType = R.Value.ToLower();

                            switch (relatedItemType)
                            {
                                case "original":
                                    while (R.Read())
                                    {
                                        if ((R.NodeType == XmlNodeType.EndElement) && ((R.Name == "mods:relatedItem") || (R.Name == "relatedItem")))
                                            break;

                                        if (R.NodeType == XmlNodeType.Element)
                                        {
                                            if ((R.Name == "mods:physicalDescription") || (R.Name == "physicalDescription"))
                                            {
                                                read_physical_description(R, ThisBibInfo.Original_Description);
                                            }
                                        }
                                    }
                                    break;

                                case "series":
                                    string part_type = String.Empty;
                                    string part_caption = String.Empty;
                                    string part_number = String.Empty;

                                    while (R.Read())
                                    {
                                        if ((R.NodeType == XmlNodeType.EndElement) && ((R.Name == "mods:relatedItem") || (R.Name == "mods:relatedItem")))
                                        {
                                            break;
                                        }

                                        if ((R.NodeType == XmlNodeType.EndElement) && ((R.Name == "mods:detail") || (R.Name == "detail")))
                                        {
                                            try
                                            {
                                                switch (part_type)
                                                {
                                                    case "Enum1":
                                                        ThisBibInfo.Series_Part_Info.Enum1 = part_caption;
                                                        ThisBibInfo.Series_Part_Info.Enum1_Index = Convert.ToInt32(part_number);
                                                        break;

                                                    case "Enum2":
                                                        ThisBibInfo.Series_Part_Info.Enum2 = part_caption;
                                                        ThisBibInfo.Series_Part_Info.Enum2_Index = Convert.ToInt32(part_number);
                                                        break;

                                                    case "Enum3":
                                                        ThisBibInfo.Series_Part_Info.Enum3 = part_caption;
                                                        ThisBibInfo.Series_Part_Info.Enum3_Index = Convert.ToInt32(part_number);
                                                        break;

                                                    case "Enum4":
                                                        ThisBibInfo.Series_Part_Info.Enum4 = part_caption;
                                                        ThisBibInfo.Series_Part_Info.Enum4_Index = Convert.ToInt32(part_number);
                                                        break;

                                                    case "Year":
                                                        ThisBibInfo.Series_Part_Info.Year = part_caption;
                                                        ThisBibInfo.Series_Part_Info.Year_Index = Convert.ToInt32(part_number);
                                                        break;

                                                    case "Month":
                                                        ThisBibInfo.Series_Part_Info.Month = part_caption;
                                                        ThisBibInfo.Series_Part_Info.Month_Index = Convert.ToInt32(part_number);
                                                        break;

                                                    case "Day":
                                                        ThisBibInfo.Series_Part_Info.Day = part_caption;
                                                        ThisBibInfo.Series_Part_Info.Day_Index = Convert.ToInt32(part_number);
                                                        break;
                                                }
                                            }
                                            catch
                                            {
                                            }

                                            part_type = String.Empty;
                                            part_caption = String.Empty;
                                            part_number = String.Empty;
                                        }

                                        if (R.NodeType == XmlNodeType.Element)
                                        {
                                            switch (R.Name)
                                            {
                                                case "mods:titleInfo":
                                                case "titleInfo":
                                                    ThisBibInfo.SeriesTitle = read_title_object(R);
                                                    break;

                                                case "mods:detail":
                                                case "detail":
                                                    if (R.MoveToAttribute("type"))
                                                    {
                                                        part_type = R.Value;
                                                    }
                                                    break;

                                                case "mods:caption":
                                                case "caption":
                                                    R.Read();
                                                    if (R.NodeType == XmlNodeType.Text)
                                                    {
                                                        part_caption = R.Value;
                                                    }
                                                    break;

                                                case "mods:number":
                                                case "number":
                                                    R.Read();
                                                    if (R.NodeType == XmlNodeType.Text)
                                                    {
                                                        part_number = R.Value;
                                                    }
                                                    break;
                                            }
                                        }
                                    }
                                    break;

                                default:
                                    Related_Item_Info newRelated = new Related_Item_Info();
                                    ThisBibInfo.Add_Related_Item(newRelated);
                                    switch (relatedItemType)
                                    {
                                        case "preceding":
                                            newRelated.Relationship = Related_Item_Type_Enum.Preceding;
                                            break;

                                        case "succeeding":
                                            newRelated.Relationship = Related_Item_Type_Enum.Succeeding;
                                            break;

                                        case "otherVersion":
                                            newRelated.Relationship = Related_Item_Type_Enum.OtherVersion;
                                            break;

                                        case "otherFormat":
                                            newRelated.Relationship = Related_Item_Type_Enum.OtherFormat;
                                            break;

                                        case "host":
                                            newRelated.Relationship = Related_Item_Type_Enum.Host;
                                            break;
                                    }
                                    if (R.MoveToAttribute("ID"))
                                        newRelated.ID = R.Value;

                                    while (R.Read())
                                    {
                                        if ((R.NodeType == XmlNodeType.EndElement) && ((R.Name == "mods:relatedItem") || (R.Name == "relatedItem")))
                                        {
                                            break;
                                        }

                                        if (R.NodeType == XmlNodeType.Element)
                                        {
                                            switch (R.Name)
                                            {
                                                case "mods:titleInfo":
                                                case "titleInfo":
                                                    newRelated.Set_Main_Title(read_title_object(R));
                                                    break;

                                                case "mods:identifier":
                                                case "identifier":
                                                    Identifier_Info thisRIdentifier = new Identifier_Info();
                                                    if (R.MoveToAttribute("type"))
                                                        thisRIdentifier.Type = R.Value;
                                                    if (R.MoveToAttribute("displayLabel"))
                                                        thisRIdentifier.Display_Label = R.Value;
                                                    R.Read();
                                                    if (R.NodeType == XmlNodeType.Text)
                                                    {
                                                        thisRIdentifier.Identifier = R.Value;
                                                        newRelated.Add_Identifier(thisRIdentifier);
                                                    }
                                                    break;

                                                case "mods:name":
                                                case "name":
                                                    newRelated.Add_Name(read_name_object(R));
                                                    break;

                                                case "mods:note":
                                                case "note":
                                                    Note_Info newRNote = new Note_Info();
                                                    if (R.MoveToAttribute("ID"))
                                                        newRNote.ID = R.Value;
                                                    if (R.MoveToAttribute("type"))
                                                        newRNote.Note_Type_String = R.Value;
                                                    if (R.MoveToAttribute("displayLabel"))
                                                        newRNote.Display_Label = R.Value;
                                                    R.Read();
                                                    if (R.NodeType == XmlNodeType.Text)
                                                    {
                                                        newRNote.Note = R.Value;
                                                        newRelated.Add_Note(newRNote);
                                                    }
                                                    break;

                                                case "mods:url":
                                                case "url":
                                                    if (R.MoveToAttribute("displayLabel"))
                                                        newRelated.URL_Display_Label = R.Value;
                                                    R.Read();
                                                    if (R.NodeType == XmlNodeType.Text)
                                                    {
                                                        newRelated.URL = R.Value;
                                                    }
                                                    break;

                                                case "mods:publisher":
                                                case "publisher":
                                                    R.Read();
                                                    if (R.NodeType == XmlNodeType.Text)
                                                    {
                                                        newRelated.Publisher = R.Value;
                                                    }
                                                    break;

                                                case "mods:recordIdentifier":
                                                case "recordIdentifier":
                                                    if (R.MoveToAttribute("source"))
                                                    {
                                                        if ((R.Value == "ufdc") || (R.Value == "dloc") || (R.Value.ToLower() == "sobekcm"))
                                                        {
                                                            R.Read();
                                                            if (R.NodeType == XmlNodeType.Text)
                                                            {
                                                                newRelated.SobekCM_ID = R.Value;
                                                            }
                                                        }
                                                    }
                                                    break;

                                                case "mods:dateIssued":
                                                case "dateIssued":
                                                    if (R.MoveToAttribute("point"))
                                                    {
                                                        if (R.Value == "start")
                                                        {
                                                            R.Read();
                                                            if (R.NodeType == XmlNodeType.Text)
                                                            {
                                                                newRelated.Start_Date = R.Value;
                                                            }
                                                        }
                                                        else if (R.Value == "end")
                                                        {
                                                            R.Read();
                                                            if (R.NodeType == XmlNodeType.Text)
                                                            {
                                                                newRelated.End_Date = R.Value;
                                                            }
                                                        }
                                                    }
                                                    break;
                                            }
                                        }
                                    }
                                    break;
                            }
                            break;

                        case "mods:subject":
                        case "subject":
                            read_subject_object(R, ThisBibInfo);
                            break;

                        case "mods:targetAudience":
                        case "targetAudience":
                            TargetAudience_Info newTarget = new TargetAudience_Info();
                            if (R.MoveToAttribute("ID"))
                                newTarget.ID = R.Value;
                            if (R.MoveToAttribute("authority"))
                                newTarget.Authority = R.Value;
                            R.Read();
                            if (R.NodeType == XmlNodeType.Text)
                            {
                                newTarget.Audience = R.Value;
                                ThisBibInfo.Add_Target_Audience(newTarget);
                            }
                            break;

                        case "mods:tableOfContents":
                        case "tableOfContents":
                            string displayLabel = null;
                            if (R.MoveToAttribute("displayLabel"))
                                displayLabel = R.Value;
                            R.Read();
                            if (R.NodeType == XmlNodeType.Text)
                            {
                                ThisBibInfo.Add_TableOfContents(R.Value, displayLabel);
                            }
                            break;

                        case "mods:titleInfo":
                        case "titleInfo":
                            Title_Info thisTitle = read_title_object(R);
                            if (thisTitle.Title_Type == Title_Type_Enum.UNSPECIFIED)
                                ThisBibInfo.Main_Title = thisTitle;
                            else
                                ThisBibInfo.Add_Other_Title(thisTitle);
                            break;

                        case "mods:typeOfResource":
                        case "typeOfResource":
                            R.Read();
                            if (R.NodeType == XmlNodeType.Text)
                            {
                                ThisBibInfo.Type.Add_Uncontrolled_Type(R.Value);
                            }
                            break;

                        case "mods:extension":
                        case "extension":
                            string schema = String.Empty;
                            string alias = String.Empty;
                            if (R.HasAttributes)
                            {
                                for (int i = 0; i < R.AttributeCount; i++)
                                {
                                    R.MoveToAttribute(i);
                                    if (R.Name.IndexOf("xmlns") == 0)
                                    {
                                        alias = R.Name.Replace("xmlns:", "");
                                        schema = R.Value;
                                        break;
                                    }
                                }
                            }
                            if (schema.IndexOf("vra.xsd") > 0)
                            {
                                read_vra_core_extensions(R, ThisBibInfo, alias, Return_Item);
                            }
                            break;
                    }
                }
            }
        }