gt: 			return new SPGD(baseRecord);
context: package esmj3dtes5.data;
  
  import java.util.HashSet;
  import java.util.List;
  
  import esmio.common.data.record.IRecordStore;
  import esmio.common.data.record.Record;
  import esmj3d.data.shared.records.LAND;
  import esmj3d.data.shared.records.LTEX;
  import esmj3d.data.shared.records.RECO;
  import esmj3d.data.shared.records.TXST;
  import esmj3dtes5.data.records.*;
  import esmj3dtes5.data.subrecords.LVLO;
  
  public class RecordToRECO
  {
  	/**
  	 * TESTING ONLY
  	 * @param master
  	 * @param cellRecord
  	 * @param children
  	 */
  	public static void makeRECOsForCELL(IRecordStore master, Record cellRecord, List<Record> children)
  	{
  		new esmj3dtes5.data.records.CELL(cellRecord);
  
  		for (Record record : children)
  		{
  			try
  			{
  				if (record.getRecordType().equals("REFR"))
  				{
  					REFR refr = new REFR(record);
  					makeREFR(refr, master);
  				}
  				else if (record.getRecordType().equals("ACHR"))
  				{
  					ACHR achr = new ACHR(record);
  					makeACHR(achr, master);
  				}
  				else if (record.getRecordType().equals("LAND"))
  				{
  					LAND land = new LAND(record);
  
  				}
  				else if (record.getRecordType().equals("PGRD"))
  				{
  
  				}
  				else if (record.getRecordType().equals("PGRE"))
  				{
  
  				}
  				else if (record.getRecordType().equals("NAVM"))
  				{
  
  				}
  				else
  				{
  					System.out.println("  Record type not converted to RECO " + record.getRecordType());
  				}
  			}
  			catch (NullPointerException e)
  			{
  				// probably just a bum pointer in the ESM
  			}
  
  		}
  	}
  
  	private static RECO makeREFR(REFR refr, IRecordStore master)
  	{
  		Record baseRecord = master.getRecord(refr.NAME.formId);
  
  		RECO reco = makeRECO(baseRecord);
  		if (reco instanceof LVLN)
  		{
  			reco = makeLVLN((LVLN) reco, master);
  		}
  
  		return reco;
  
  	}
  
  	public static RECO makeLVLI(LVLI lvli, IRecordStore master)
  	{
  		// TODO: randomly picked for now
  		LVLO[] LVLOs = lvli.LVLOs;
  
  		int idx = (int) (Math.random() * LVLOs.length);
  		idx = idx == LVLOs.length ? 0 : idx;
  
  		Record baseRecord = master.getRecord(LVLOs[idx].itemFormId);
  
  		if (baseRecord.getRecordType().equals("NPC_"))
  		{
  			// it is in fact a pointer across to another leveled creature (LVLC)
  			return new NPC_(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("LVLI"))
  		{
  			// it is in fact a pointer across to another leveled character (LVLN)
  			makeLVLI(new LVLI(baseRecord), master);
  		}
  		else
  		{
  			System.out.println("LVLI record type not converted to j3d " + baseRecord.getRecordType());
  		}
  
  		return null;
  	}
  
  	private static RECO makeLVLN(LVLN lvln, IRecordStore master)
  	{
  		// TODO: randomly picked for now
  		LVLO[] LVLOs = lvln.LVLOs;
  
  		int idx = (int) (Math.random() * LVLOs.length);
  		idx = idx == LVLOs.length ? 0 : idx;
  
  		Record baseRecord = master.getRecord(LVLOs[idx].itemFormId);
  
  		if (baseRecord.getRecordType().equals("NPC_"))
  		{
  			// it is in fact a pointer across to another leveled creature (LVLC)
  			return new NPC_(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("LVLN"))
  		{
  			// it is in fact a pointer across to another leveled character (LVLN)
  			makeLVLN(new LVLN(baseRecord), master);
  		}
  		else
  		{
  			System.out.println("LVLN record type not converted to j3d " + baseRecord.getRecordType());
  		}
  
  		return null;
  	}
  
  	private static RECO makeACHR(ACHR achr, IRecordStore master)
  	{
  		Record baseRecord = master.getRecord(achr.NAME.formId);
  		if (baseRecord.getRecordType().equals("NPC_"))
  		{
  			return new NPC_(baseRecord);
  		}
  		else
  		{
  			System.out.println("ACHR record type not converted to j3d " + baseRecord.getRecordType());
  		}
  
  		return null;
  	}
  
  	public static RECO makeRECO(Record baseRecord)
  	{
  		if (baseRecord.getRecordType().equals("GMST"))
  		{
  			return new GMST(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("KYWD"))
  		{
  			return new KYWD(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("LCRT"))
  		{
  			return new LCRT(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("AACT"))
  		{
  			return new AACT(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("TXST"))
  		{
  			return new TXST(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("GLOB"))
  		{
  			return new GLOB(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("CLAS"))
  		{
  			return new CLAS(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("FACT"))
  		{
  			return new FACT(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("HDPT"))
  		{
  			return new HDPT(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("EYES"))
  		{
  			return new EYES(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("RACE"))
  		{
  			return new RACE(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("SOUN"))
  		{
  			return new SOUN(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("ASPC"))
  		{
  			return new ASPC(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("MGEF"))
  		{
  			return new MGEF(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("LTEX"))
  		{
  			return new LTEX(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("ENCH"))
  		{
  			return new ENCH(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("SPEL"))
  		{
  			return new SPEL(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("SCRL"))
  		{
  			return new SCRL(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("ACTI"))
  		{
  			return new ACTI(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("TACT"))
  		{
  			return new TACT(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("ARMO"))
  		{
  			return new ARMO(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("BOOK"))
  		{
  			return new BOOK(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("CONT"))
  		{
  			return new CONT(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("DOOR"))
  		{
  			return new DOOR(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("INGR"))
  		{
  			return new INGR(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("LIGH"))
  		{
  			return new LIGH(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("MISC"))
  		{
  			return new MISC(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("APPA"))
  		{
  			return new APPA(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("STAT"))
  		{
  			return new STAT(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("MSTT"))
  		{
  			return new MSTT(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("GRAS"))
  		{
  			return new GRAS(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("TREE"))
  		{
  			return new TREE(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("FLOR"))
  		{
  			return new FLOR(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("FURN"))
  		{
  			return new FURN(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("WEAP"))
  		{
  			return new WEAP(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("AMMO"))
  		{
  			return new AMMO(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("KEYM"))
  		{
  			return new KEYM(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("ALCH"))
  		{
  			return new ALCH(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("IDLM"))
  		{
  			return new IDLM(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("COBJ"))
  		{
  			return new COBJ(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("PROJ"))
  		{
  			return new PROJ(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("HAZD"))
  		{
  			return new HAZD(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("SLGM"))
  		{
  			return new SLGM(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("WTHR"))
  		{
  			return new WTHR(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("CLMT"))
  		{
  			return new CLMT(baseRecord);
  		}
  		else if (baseRecord.getRecordType().equals("SPGD"))
  		{
  