public Result iddfs_helper(Integer i)
	{		
		Deque<Node> stack = new ArrayDeque<Node>();

		int nodesProcessed = 0;

		stack.addFirst(initial);

		while(!stack.isEmpty())
		{

			Node temp = stack.removeFirst();
			nodesProcessed++;
			if(temp.getCost() <= i)
			{

				if(temp.getState().equals(finalState)) {
					long endTime = System.currentTimeMillis();

					Deque<Grid.Direction> pathStack = new ArrayDeque<Grid.Direction>();
					pathStack.add(temp.getDirection());
					Node temp2 = temp.getParent();

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

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

					if(!pathStack.peek().toString().equals(null))
					{
						while(!pathStack.isEmpty())
						{
							pathTaken.append(pathStack.removeFirst().toString());
						}
					}
					return new Result(pathTaken.toString(), nodesProcessed, endTime);
				}
				else
				{
					for(Node n: temp.successors())
					{
						stack.addFirst(n);
					}
				}
			}
		}

		return new Result("n", nodesProcessed, 0);

	}