public void undo()
	{	    
		if (movesHistory.size() >= 2 && m_canUndo)
		{
			m_game_board.decrementTurncount();

			String returnMove2 = movesHistory.pop();
			String returnMove1 = movesHistory.pop();

			//Here, we reconstruct the FEN from movesHistory so as not to have turncount and 50movecount
			String[] returnMove2Parts = returnMove2.split(" ");
			String returnMove2Key = "";
			int i;
			for (i = 0; i < returnMove2Parts.length - 3; i++)
				returnMove2Key = returnMove2Key + returnMove2Parts[i] + " ";			
			returnMove2Key += returnMove2Parts[i];
			
			String[] returnMove1Parts = returnMove1.split(" ");
			String returnMove1Key = "";
			for (i = 0; i < returnMove1Parts.length - 3; i++)
				returnMove1Key = returnMove1Key + returnMove1Parts[i] + " ";

			returnMove1Key += returnMove1Parts[i];

			//decrement three move repetition hash table as necessary
			if (repeats.get(returnMove2Key) > 1)
				repeats.put(returnMove2Key, repeats.get(returnMove2Key) - 1);
			else //remove from hash table if it only occurred once
				repeats.remove(returnMove2Key);

			//do same for other move that got undone
			if (repeats.get(returnMove1Key) > 1)
				repeats.put(returnMove1Key, repeats.get(returnMove1Key) - 1);
			else
				repeats.remove(returnMove1Key);

			m_game_board.FENtoPosition(returnMove1); //restore position from two ply prior
		}
	}