@SuppressWarnings("boxing")
	@Override
	public LinkedList<Character> search(Node problem) {
		frontier.clear(); //clear previous nodes from previous puzzles etc
		Map<String, Integer> map = new HashMap<>();
		addToFrontier(problem); //start pq with first node
		while (!frontier.isEmpty()) {
			Node node = removeFromFrontier(); //get next node on pq
			if (node.isGoal()) {
				return node.path();
			}
			if (!inShallower(node, map) && !cutoff(node)) { 
				map.put(node.getState(), node.getDepth()); //add this path to map of checked paths
				for (Node neighbor : node.expand()) { //add neighbors to the frontier
					addToFrontier(neighbor);  
				}
			}
		}
		return null;
	}