private static void addContigLayer(JsonObject root) throws Exception
	{
		List<JsonObject> list = new ArrayList<JsonObject>();
		addNodeAndChildren(root, list);
		System.out.println("Got " + list.size() + " flat nodes");
		
		HashMap<Integer, List<JsonObject>> outerMap = new HashMap<Integer, List<JsonObject>>();
		
		for(JsonObject json : list) 
		{
			int genomicLevel = Integer.parseInt(json.getNameValuePairMap().get("contig"));
			
			if(genomicLevel == 0)
			{
				if( ! json.getNameValuePairMap().get("name").equals("root") )
				{
					throw new Exception("Logic error");
				}
			}
			else if (json.getNameValuePairMap().get("level").equals("operon"))
			{
				List<JsonObject> aList = outerMap.get(genomicLevel);
				
				if( aList == null)
				{
					aList = new ArrayList<JsonObject>();
					outerMap.put(genomicLevel, aList);
				}
				
				aList.add(json);
			}
		}
		
		List<Integer> outerKeys = new ArrayList<Integer>(outerMap.keySet());
		Collections.sort(outerKeys);
		
		root.getChildren().clear();
		
		if( root.getChildren().size() != 0)
			throw new Exception("Could not clear list");
		
		for( Integer i : outerKeys )
		{
			List<JsonObject> innerList = outerMap.get(i);
			Collections.sort(innerList, new SortByPosition());
			
			JsonObject jsonObject = new JsonObject();
			jsonObject.makeNewEmptyChildrenList();
			jsonObject.getChildren().addAll(innerList);
			jsonObject.getNameValuePairMap().put("level", "contig");
			jsonObject.getNameValuePairMap().put("name", "contig" + i);
			jsonObject.getNameValuePairMap().put("log_pValue.il02.ilaom02", "0");
			jsonObject.getNameValuePairMap().put("log_pValue.il12.ilaom12", "0");
			jsonObject.getNameValuePairMap().put("log_pValue.il20.ilaom20", "0");
			jsonObject.getNameValuePairMap().put("fc.il02.ilaom02", "0");
			jsonObject.getNameValuePairMap().put("fc.il12.ilaom12", "0");
			jsonObject.getNameValuePairMap().put("fc.il12.ilaom20", "0");
			jsonObject.getNameValuePairMap().put("genomic.location",  i + ".0");
			jsonObject.getNameValuePairMap().put("contig",  i + ".0");
			jsonObject.getNameValuePairMap().put("position",  "0");
			root.getChildren().add(jsonObject);
		}
			
	}