public void handleProgram(ASTProgram node) {
    program = node;
    // System.out.println("visiting program");
    Global.setCurrentSymbolTable(Global.getSymbolTable());
    update(1, UPDATE_REASON_BEGIN);
    startQuestion = questionFactory.getStartQuestion();
    // Drawing Stuff
    connector.addScope(Global.getSymbolTable(), "Global", null);
    connector.startPar(); // STARTPAR
    connector.showScope("Global");
    connector.endPar(); // ENDPAR
    // connector.endSnap();

    node.jjtGetChild(0).jjtAccept(this, null);
    update(LINE_NUMBER_END, UPDATE_REASON_END);

    int value = 0;

    try {
      value = Global.getSymbolTable().get(startQuestion.getVariable());
      System.out.println(startQuestion.getVariable() + " is " + value);
    } catch (Exception e) {
      System.out.println(e);
    }
    if (startQuestion instanceof FIBQuestion) {

      ((FIBQuestion) startQuestion).addAnswer(value + "");
    } else if (startQuestion instanceof TFQuestion) {
      Random r = new Random();
      int prob = r.nextInt(10);
      int qa = value;
      if (prob >= 3 && value != startQuestion.getValue()) {
        qa = startQuestion.getValue();
        ((TFQuestion) startQuestion).setAnswer(false);
      } else {
        ((TFQuestion) startQuestion).setAnswer(true);
      }
      startQuestion.setText(startQuestion.getText() + qa + ".");
    }

    // TODO Write the last snap nicely

    connector.startSnap(node.getPseudocode().length);
    connector.startPar(); // STARTPAR
    // we can't hide foo in by macro cuz it doesn't exist
    if (!byMacroFlag) connector.hideScope("foo");
    connector.endPar(); // ENDPAR
    connector.endSnap();
  }
  public Integer handleVar(ASTVar node) {
    System.out.println(node.jjtGetParent());
    Integer value = -256;
    int index = -10000;
    String name = node.getName();
    if (node.isArg()) {
      name += "_";
    }

    if (JustCalling) {
      return value;
    }
    Variable v = Global.getCurrentSymbolTable().getVariable(name);
    if (v instanceof ByNameVariable) {
      v = Global.getCurrentSymbolTable().getCacheVariable(name);
      System.out.println(v + " should be null the first time");
      if (v != null) {
        int ret = 0;
        try {
          ret = v.getValue();
        } catch (VizIndexOutOfBoundsException e) {
          System.out.println(e);
        }
        return ret;
      }
    } else {
      v = Global.getCurrentSymbolTable().getVariable(name);
    }

    boolean cached = false;
    if (v == null) {

      v = Global.getCurrentSymbolTable().getVariable(name);
      System.out.println(v);
      int val = 0;
      try {
        val = v.getValue();

        Global.getCurrentSymbolTable().addCacheVariable(name, val);

      } catch (VizIndexOutOfBoundsException e) {
        System.out.println(e);
      }
      if (node.getIsArray()) {
        name += "[" + ((SimpleNode) node.jjtGetChild(0)).getCode() + "]";
      }
      connector.addVariableToCache(name, val, "foo");
    } else {
      cached = true;
    }

    if (v instanceof ByNameVariable) {
      try {
        value = v.getValue();
      } catch (VizIndexOutOfBoundsException e) {
        System.out.println(e);
      }
    } else {
      if (node.getIsArray()) {
        index = (Integer) node.jjtGetChild(0).jjtAccept(this, null);
        node.setIndex(index);
        try {
          value = v.getValue(index);

        } catch (VizIndexOutOfBoundsException e) {
          System.out.println(e);
          ASTExpression exp = (ASTExpression) node.jjtGetChild(0);
          ASTNum num = new ASTNum(JJTNUM);
          Random r = new Random();
          num.setValue(r.nextInt(6));
          exp.jjtAddChild(num, 0);
          try {
            index = (Integer) exp.jjtAccept(this, null);
            value = v.getValue(index);
          } catch (VizIndexOutOfBoundsException f) {
            System.out.println("oops...");
          }
          program.codeBuilt = false;
          Global.lineNumber = 1;
          program.buildCode();
        }
      } else {
        try {
          value = v.getValue();
        } catch (VizIndexOutOfBoundsException f) {
          System.out.println(f);
        }
      }
      System.out.println("F*****g " + value + v + cached);
    }
    if (v instanceof ByNameVariable) {
      if (cached) {
        connector.highlightVarByName(v);
      } else {

        connector.greyScope("foo");

        connector.highlightScopeByName("main");
        if (((ByNameVariable) v).getVariable().getIsArray()) {
          connector.highlightVarByName(
              ((ByNameVariable) v).getVariable(), ((ByNameVariable) v).getIndex());
        } else {
          connector.highlightVarByName(((ByNameVariable) v).getVariable());
        }
      }
    } else {

      if (node.getIsArray()) {
        // connector.highlightVarByName(v, index);
      } else {
        // connector.highlightVarByName(v);
      }
    }
    return value;
  }