Pos followSuffixLink( Pos pos )
	{
	   // gama is the string between node and its father, in case node 
	   // doesn't have a suffix link
	   Path gama = new Path();   
	   // dummy argument for trace_string function
	   int charsFound = 0;   
	   
	   if ( pos.node == root )
	      return pos;
	   // if node has no suffix link yet or in the middle of an edge - remember the 
	   // doesn't have edge between the node and its father (gama) and follow its 
	   // father's suffix link (it must have one by Ukkonen's lemma). After 
	   // following, trace down gama - it must exist in the tree (and thus can use 
	   // the skip trick - see traceString function description)
	   if ( pos.node.suffixLink == null || !isLastCharInEdge(pos.node,pos.edgePos) )
	   {
		   // if the node's father is the root, than no use following it's link (it 
		   // is linked to itself). Tracing from the root (like in the naive 
		   // algorithm) is required and is done by the calling function SEA upon 
		   // receiving a return value of tree->root from this function 
		   if ( pos.node.father == root )
		   {
	    	  pos.node = root;
	    	  return pos;
		   }
		   // store gama - the indices of node's incoming edge
		   gama.begin = pos.node.edgeLabelStart;
		   gama.end = pos.node.edgeLabelStart + pos.edgePos;
		   // follow father's suffix link
		   pos.node = pos.node.father.suffixLink;
		   // down-walk gama back to suffixLink's son
		   TraceReturnValue trv = new TraceReturnValue();
		   trv.edgePos = pos.edgePos;
		   trv.charsFound = charsFound;
		   pos.node = traceString( pos.node, gama, trv, SkipType.skip );
		   pos.edgePos = trv.edgePos;
	   }
	   else
	   {
		   // if a suffix link exists - just follow it
		   pos.node = pos.node.suffixLink;
		   pos.edgePos = getNodeLabelLength( pos.node )-1;
	   }
	   return pos;
	}