public String spellCheckEditDistance(String wrong)
	{
		String correct;  
		int distance=0;
	    //System.out.println("Calculating distances of wrong word from all possible words...");
		int min = Integer.MAX_VALUE;
		Set<String> candidates = new HashSet<String>();
		
	    for (int i = 0 ; i < correctWords.size() ; i++)
		{   
			correct = correctWords.get(i);
		    //calculate distance between correctWords[i] and wrong
			//add to appropriate data structure
			distance = editDistance(wrong, correct);
			if(min > distance) //min changes
			{
				min = distance;
				candidates.clear(); //flush set
				candidates.add(correct); // add current word to set
			}
			else if (min == distance) //a word with edit dist = min found hence it is a candidate
			{
				candidates.add(correct);
			}
			else //word with edit dist > min 
			{
				//do nothing
			}
			//System.out.println("The edit distance between \"" + wrong + "\" and \"" + correct + "\" is " + distance);
			
		}
	    System.out.println("min distance: "+min);
	    System.out.println("-----------------\nCandidates:\n------------------");
	    Iterator<String> iterator = candidates.iterator();
	    double candidateProbability = 0.0;
	    double maxProbability = 0.0;
	    String best="";
	    while(iterator.hasNext())
	    {
	    	String candidateWord = iterator.next();
	    	System.out.println(candidateWord);
	    	//candidateProbability = bigrams.getProbability(candidateWord);
	    	candidateProbability = bigWordCounts.getProbability(candidateWord); 
	    	if(maxProbability <= candidateProbability)
	    	{
	    		maxProbability = candidateProbability;
	    		best = candidateWord;
	    	}
	    }
	    System.out.println("-----------------");
	    System.out.println("Best Word: " + best);
		
		return best;
	}