public Result astar()
	{
		long startTime = System.currentTimeMillis();
		HashSet<HeuristicNode> seen = new HashSet<HeuristicNode>();
		Queue<HeuristicNode> toConsider = new PriorityQueue<HeuristicNode>();
		//Map<Node, Node> routesTaken = new HashMap<Node, Node>();

		int nodesProcessed = 0;

		toConsider.add(new HeuristicNode(initial, 0));

		while(!toConsider.isEmpty())
		{
			HeuristicNode current = toConsider.poll();
			nodesProcessed++;
			/*	System.out.println(Arrays.toString(current.state.state));
			System.out.println(Arrays.toString(finalState.state));*/
			if(current.getNode().getState().equals(finalState))
			{
				long endTime = System.currentTimeMillis();
				Deque<Grid.Direction> pathStack = new ArrayDeque<Grid.Direction>();
				pathStack.add(current.getNode().getDirection());
				Node temp2 = current.getNode().getParent();

				while(temp2.getParent() != null)
				{
					pathStack.addFirst(temp2.getDirection());
					temp2 = temp2.getParent();
				}

				StringBuilder pathTaken = new StringBuilder(pathStack.size());

				if(pathStack.peek().toString().equals(null))
				{

				}
				else
				{
					while(!pathStack.isEmpty())
					{

						pathTaken.append(pathStack.removeFirst().toString());
					}
				}

				return new Result(pathTaken.toString(), nodesProcessed, startTime-endTime);
			}
			else
			{
				seen.add(current);

				for(Node n : current.getNode().successors())
				{
					int childFscore = n.getCost() + heuristic(n);
					HeuristicNode newN = new HeuristicNode(n, childFscore);
					if(!seen.contains(newN))
					{
						if(!toConsider.contains(newN) || toConsider.peek().getFscore() > childFscore)
						{
							//routesTaken.put(current, n);
							toConsider.add(newN);
						}
					}
				}
			}
		}

		return null;

	}