private ArrayList<Node> getValidSurroundingNodes(Node n) {
      ArrayList<Point> tempArrayList = new ArrayList<Point>();

    for (int x = -1; x <= 1; x++) {
      for (int y = -1; y <= 1; y++) {
        if (!((x == 0) && (y == 0))) {
          tempArrayList.add(new Point(n.x + x, n.y + y));
        }
      }
    }

    // now we check to see if any of these isn't white on the mask.

//    System.out.println(tempArrayList.size());

      ArrayList<Node> newList = new ArrayList<Node>();

    Node nextItem;


    for (int i = 0; i < tempArrayList.size(); i++) {
      nextItem = new Node(tempArrayList.get(i), n);
      //System.out.println(nextItem);
      if ((onScreen(nextItem.x, nextItem.y)) && mask.getRGB(nextItem.x, nextItem.y) == Color.WHITE.getRGB()) {
        newList.add(nextItem);
      }
    }
    //System.out.println(newList.size());

    return newList;
  }