private static PlanetData GeneratePlanet(PlanetData.ePlanetType planetType, StarData curSys, int systemSpot)
    {
        PlanetData cPlan = new PlanetData();
        PlanetAttributeTable pTable = new PlanetAttributeTable();
        PlanetAttributeData pData = new PlanetAttributeData();

        // assign the attribute table for the planet type
        try
        {
            pData = DataManager.planetAttributeDataList.Find(p => p.planetType == planetType);
            pTable = pData.planetTraitsTable;
        }
        catch (Exception ex)
        {
            Debug.LogError("Could not lookup " + planetType.ToString() + " table for planet type " + planetType.ToString() + "! Error:" + ex.ToString());
            return null; // try again with the next planet
        }
        // Step 0: Log spot of planet in system
        cPlan.PlanetSpot = systemSpot;

        // Step 1: Determine type of planet
        cPlan.Type = (StellarObjects.PlanetData.ePlanetType)planetType; // assign the planet type

        // Step 2: Pick name for planet and assign ID(will change to generic star name)
        systemSpot = curSys.PlanetList.Count + 1;

        if (cPlan.Type == PlanetData.ePlanetType.AsteroidBelt)
            cPlan.Name = curSys.Name + " AB-" + HelperFunctions.StringConversions.ConvertToRomanNumeral(systemSpot);

        else if (cPlan.Type == PlanetData.ePlanetType.IceBelt)
            cPlan.Name = curSys.Name + " IB-" + HelperFunctions.StringConversions.ConvertToRomanNumeral(systemSpot);

        else if (cPlan.Type == PlanetData.ePlanetType.DustRing)
            cPlan.Name = curSys.Name + " DR-" + HelperFunctions.StringConversions.ConvertToRomanNumeral(systemSpot);

        else
            cPlan.Name = curSys.Name + " " + HelperFunctions.StringConversions.ConvertToRomanNumeral(systemSpot); // convert to planet and spot

        cPlan.ID = curSys.Name.Substring(0,2) + UnityEngine.Random.Range(0,9999); // set ID

        // Step 3: Determine size/axial tilt of planet
        try
        {
            int sizeVar = UnityEngine.Random.Range(0, pTable.sizeVar);
            int sizeResult = pTable.size + sizeVar;
            cPlan.Size = sizeResult; // sizeMod;
        }
        catch(Exception ex)
        {
            Debug.LogError("Could not calcuate. Error: " + ex.ToString());
        }

        cPlan.AxialTilt = UnityEngine.Random.Range(0f, 70f); // tilt between 0-70

        // Step 4: Determine habitibility of planet
        try
        {
           int habVar = UnityEngine.Random.Range(0, pTable.habVar);
           float habResult = pTable.habitability + habVar;
           float spotVar = 0f;
           switch (cPlan.PlanetSpot)
           {
               case 1:
                   if ((int)curSys.SpectralClass < 5)
                   {
                       spotVar = .6f;
                       break;
                   }
                   else
                   {
                       spotVar = .9f;
                       break;
                   }

               case 2:
                   spotVar = .9f;
                   break;
               case 3:
                   spotVar = 1f;
                   break;
               case 4:
                   spotVar = 1f;
                   break;
               case 5:
                   spotVar = .9f;
                   break;
               case 6:
                   spotVar = .7f;
                   break;
               default:
                   spotVar = 1f;
                   break;
           }
            cPlan.Bio = (int)(habResult * spotVar);
        }
        catch (Exception ex)
        {
            Debug.LogError("Could not calcuate. Error: " + ex.ToString());
        }

        // Step 5: Determine industrial modifier of planet
        cPlan.IndustrialMultiplier = (pTable.indMult / 100);

        // Step 6: Determine if planet has any rings
        if (UnityEngine.Random.Range(0, 100) <= pTable.ringChance)
            cPlan.Rings = true;
        else
            cPlan.Rings = false;

        // Step 7: Determine how many moons the planet has
        if (UnityEngine.Random.Range(0, 100) <= pTable.moonChance)
            cPlan.Moons = UnityEngine.Random.Range(1,pTable.maxMoons); // change later to expand on moons

        // Step 7b: Adjust habitability based on moons
        if (cPlan.Moons > 0)
            if (((int)cPlan.Type == 7) || ((int)cPlan.Type == 8))
            {
                cPlan.Bio += (cPlan.Moons * 2);
            }
        if (((int)cPlan.Type == 10) || ((int)cPlan.Type == 3) || ((int)cPlan.Type == 2) || ((int)cPlan.Type == 13))
            {
                cPlan.Bio += (cPlan.Moons * 5);
            }

        // Step 8: Determine rating of alpha materials
        try
        {
            int alphaVar = UnityEngine.Random.Range(0, pTable.alpVar);
            cPlan.BasicMaterials = pTable.alpMaterial + alphaVar;
        }
        catch (Exception ex)
        {
            Debug.LogError("Could not calcuate. Error: " + ex.ToString());
        }

        // Step 9: Determine rating of heavy materials
        try
        {
            int heavyVar = UnityEngine.Random.Range(0, pTable.heavVar);
            cPlan.HeavyMaterials = (int)(pTable.heavyMaterial * (1 + (curSys.pMaterial / 20)));
            cPlan.HeavyMaterials = cPlan.HeavyMaterials * (1 + ((5 - systemSpot) / 10));
            cPlan.HeavyMaterials += heavyVar;

        }
        catch (Exception ex)
        {
            Debug.LogError("Could not calcuate. Error: " + ex.ToString());
        }

        // Step 10: Determine rating of rare materials
        try
        {
            int rareMod = UnityEngine.Random.Range(0, pTable.rareVar);
            cPlan.RareMaterials = (int)(pTable.rareMaterial * (1 + (curSys.pMaterial / 12)));
            cPlan.RareMaterials = cPlan.RareMaterials * (1 + ((5 - systemSpot) / 8));
            cPlan.RareMaterials += rareMod;
        }
        catch (Exception ex)
        {
            Debug.LogError("Could not calcuate. Error: " + ex.ToString());
        }

        // Step 11: Determine energy rating
        try
        {
            cPlan.Energy = (int)(pTable.energy * (1 + (curSys.pMaterial / 12)));
            cPlan.Energy = cPlan.Energy * (1 + ((5 - systemSpot) / 10));
            cPlan.Energy += UnityEngine.Random.Range(0, 30);
        }
        catch (Exception ex)
        {
            Debug.LogError("Could not calcuate. Error: " + ex.ToString());
        }

        // Step 12: Generate sprite number (to show type of planet)
        if ((cPlan.Type != PlanetData.ePlanetType.DustRing) && (cPlan.Type != PlanetData.ePlanetType.IceBelt) && (cPlan.Type != PlanetData.ePlanetType.AsteroidBelt))
            cPlan.PlanetSpriteNumber = UnityEngine.Random.Range(0, SpritesPerPlanetType - 1);
        else
            cPlan.PlanetSpriteNumber = UnityEngine.Random.Range(0, SpritesPerBeltType - 1);

        // Step 13: Generate ring sprite number if applicable
        cPlan.PlanetRingSpriteNumber = UnityEngine.Random.Range(0, SpritesPerRingType - 1);
        cPlan.PlanetRingTilt = UnityEngine.Random.Range(-10, 10);

        // Step 13: Determine planetary traits
        DeterminePlanetTraits(cPlan);

        // Step 14: Determine total and habitable tiles based on bio level
        cPlan.MaxTiles = (cPlan.Size / 3);
        for (int x = 0; x < cPlan.MaxTiles; x++)
        {
            if (UnityEngine.Random.Range(0, 100) < cPlan.AdjustedBio)
            {
                cPlan.MaxHabitableTiles += 1;
            }
        }

        // Step 15: Create and assign tiles to the planet
        GeneratePlanetRegions(cPlan);

        // Step 16: Send the planet data back!
        return cPlan;
    }