private void recurseTree(HashSet<PrimitiveBox> notTraversed, List<List<PrimitiveBox>> instructionTree, PrimitiveBox primUI, byte depth)
{
if (primUI == null || !notTraversed.Contains(primUI)) return;
while (depth >= instructionTree.Count) instructionTree.Add(new List<PrimitiveBox>());
instructionTree[depth].Add(primUI);
notTraversed.Remove(primUI);
//traverse false then true branch
recurseTree(notTraversed, instructionTree, primUI.TrueUI, (byte)(depth + 1));
recurseTree(notTraversed, instructionTree, primUI.FalseUI, (byte)(depth + 1));
}