public ArrayList<String> wordList(String inWord, String finalWord, int pos, ArrayList<String> sol, ArrayList<String> exp){
		int value;
		ArrayList<String> newList = new ArrayList<String>();
		Iterator<String> i = words.iterator();
		while (i.hasNext()) 
		{
			String temp = i.next();
			int count = 0;
			Iterator<String> j = sol.iterator(); 
			while(j.hasNext()){      //check if any words are the solution words, ignore if they are
				String temp2 = j.next();
				if(temp.equals(temp2)){
					count++;
				}
			}
			Iterator<String> k = exp.iterator(); 
			while(k.hasNext()){          //check if any words are already explored, ignore if they are
				String temp3 = k.next();   
				if(temp.equals(temp3)){   
					count++;   
				}
			}
			if(count != 0){
				continue;
			}
			if(difference(temp,inWord) == 4){
				if(position(temp,inWord) != pos){
				    value = 5 - difference(temp,finalWord); //distance from final word
				    temp = Integer.toString(value) + temp; //add distance
				    newList.add(temp);
			}
		}
			
	}
		Collections.sort(newList); //sorts words according to how close they are to target word
		ArrayList<String> newList2 = new ArrayList<String>();
		Iterator<String> it = newList.iterator();
		while(it.hasNext()){   //remove distance from each word
			String temp = it.next();
			temp = temp.substring(1,6);
			newList2.add(temp);
			
		}
		//System.out.println(newList);
		return newList2;
	}