Index: Singular/extra.cc
===================================================================
--- Singular/extra.cc	(revision e7bc2f336cc15e7490e435edaaca6c95b8c97e58)
+++ Singular/extra.cc	(revision 005d00a69a06222e30f1744e5e9276adcfd22649)
@@ -3507,6 +3507,8 @@
 		  heuristic=(int)(long)h->next->Data();
 		  ideal I=((ideal)h->Data());
-		  res->rtyp=IDEAL_CMD;
-		  res->data=(ideal) gfan(I,heuristic);
+// 		  res->rtyp=IDEAL_CMD;
+// 		  res->data=(ideal) gfan(I,heuristic);
+		  res->rtyp=LIST_CMD;
+		  res->data=(lists) gfan(I,heuristic);
 		  return FALSE;
 	  }
Index: kernel/gfan.cc
===================================================================
--- kernel/gfan.cc	(revision e7bc2f336cc15e7490e435edaaca6c95b8c97e58)
+++ kernel/gfan.cc	(revision 005d00a69a06222e30f1744e5e9276adcfd22649)
@@ -101,4 +101,6 @@
 		
 /** \brief Constructor for facets of codim >= 2
+* Note that as of now the code of the constructors is only for facets and codim2-faces. One
+* could easily change that by renaming numCodim2Facets to numCodimNminusOneFacets or similar
 */
 facet::facet(int const &n)
@@ -756,6 +758,6 @@
 	// The inequalities are now stored in ddineq
 	// Next we check for superflous rows
-	time_t canonicalizeTic, canonicalizeTac;
-	time(&canonicalizeTic);
+// 	time_t canonicalizeTic, canonicalizeTac;
+// 	time(&canonicalizeTic);
 // 	ddredrows = dd_RedundantRows(ddineq, &dderr);
 // 	if (dderr!=dd_NoError)			// did an error occur?
@@ -774,6 +776,6 @@
 		
 	dd_MatrixCanonicalize(&ddineq, &ddlinset, &ddredrows, &ddnewpos, &dderr);
-	time(&canonicalizeTac);
-	cout << "dd_MatrixCanonicalize time: " << difftime(canonicalizeTac,canonicalizeTic) << "sec" << endl;
+// 	time(&canonicalizeTac);
+// 	cout << "dd_MatrixCanonicalize time: " << difftime(canonicalizeTac,canonicalizeTic) << "sec" << endl;
 	ddrows = ddineq->rowsize;	//Size of the matrix with redundancies removed
 	ddcols = ddineq->colsize;
@@ -2036,8 +2038,8 @@
 		while(fAct!=NULL)
 		{	//Since SLA should only contain flippables there should be no need to check for that
-			time(&tic);
+			
 			gcAct->flip(gcAct->gcBasis,fAct);
-			time(&tac);
-			cout << "t_flip = " << difftime(tac,tic) << endl;
+			
+			
 			ring rTmp=rCopy(fAct->flipRing);
 			rComplete(rTmp);			
@@ -2054,9 +2056,7 @@
 // 			idDelete((ideal *)&fAct->flipGB);
 // 			rDelete(fAct->flipRing);
-			time(&tic);
-			gcTmp->getConeNormals(gcTmp->gcBasis, FALSE);					
-			time(&tac);
-			cout << "t_getConeNormals = " << difftime(tac,tic) << endl;
-			gcTmp->getCodim2Normals(*gcTmp);					
+			
+			gcTmp->getConeNormals(gcTmp->gcBasis, FALSE);	
+			gcTmp->getCodim2Normals(*gcTmp);
 			gcTmp->normalize();
 #ifdef gfan_DEBUG
@@ -2897,8 +2897,53 @@
 // }
 
+void gcone::lprepareResult(lists l, gcone &gc)
+{
+	gcone *gcAct;
+	gcAct = &gc;
+	matrix mFacetNormal=mpNew(counter,gc.numVars);
+	
+	facet *fAct;
+	fAct = gc.facetPtr;
+	while( gcAct!=NULL )
+	{
+		l->m[0].data=(int*)gc.getUCN();
+		l->m[1].data=(intvec*)(&gcAct->f2M(gcAct,gcAct->facetPtr));
+		gcAct = gcAct->next;
+	}
+}
+/** \brief Write facets of a cone into a matrix
+* Takes a pointer to a facet as 2nd arg in order to determine whether 
+* it operates in codim 1 or 2
+*/
+intvec gcone::f2M(gcone *gc, facet *f)
+{
+	facet *fAct;
+	int codim=1;
+	if(f==gc->facetPtr)
+		fAct = gc->facetPtr;
+	else
+	{
+		fAct = gc->facetPtr->codim2Ptr;
+		codim=2;
+	}
+	intvec mRes=new intvec(counter,gc->numVars,0);//nrows==counter, ncols==numVars
+	intvec *fNormal = new intvec(this->numVars);
+	for(int ii=0;ii<gc->numFacets*(this->numVars);ii++)
+	{
+		fNormal=fAct->getFacetNormal();
+		for(int jj=0;jj<this->numVars ;jj++ )
+		{			
+			mRes[ii]=(*fNormal)[jj];
+			ii++;
+		}
+		fAct = fAct->next;
+	}
+	return mRes;
+}
 
 int gcone::counter=0;
 int gfanHeuristic;
-ideal gfan(ideal inputIdeal, int h)
+// ideal gfan(ideal inputIdeal, int h)
+lists gfan(ideal inputIdeal, int h)
 {
 	lists lResList=(lists)omAllocBin(slists_bin);
@@ -2906,6 +2951,6 @@
 	lResList->m[0].rtyp=INT_CMD;
 	lResList->m[0].data=(int*)255;
-	lResList->m[1].rtyp=MATRIX_CMD;
-	lResList->m[1].data=(void*)NULL;
+	lResList->m[1].rtyp=INTVEC_CMD;
+	lResList->m[1].data=(intvec*)NULL;
 	lResList->m[2].rtyp=IDEAL_CMD;
 	lResList->m[2].data=(ideal*)NULL;
@@ -3002,6 +3047,9 @@
 		//Below is a workaround, since gcAct->gcBasis gets deleted in noRevS
 		res = inputIdeal; 
+// 		intvec mRes=gcRoot->f2M(gcRoot,gcRoot->facetPtr);
+		gcRoot->lprepareResult(lResList,*gcRoot);
 	}
 	dd_free_global_constants();
+	
 	/*As of now extra.cc expects gfan to return type ideal. Probably this will change in near future.
 	The return type will then be of type LIST_CMD
@@ -3014,5 +3062,6 @@
 	//res=gcAct->gcBasis;
 	//res=gcRoot->gcBasis;	
-	return res;
+// 	return res;
+	return lResList;
 	//return GBlist;
 }
Index: kernel/gfan.h
===================================================================
--- kernel/gfan.h	(revision e7bc2f336cc15e7490e435edaaca6c95b8c97e58)
+++ kernel/gfan.h	(revision 005d00a69a06222e30f1744e5e9276adcfd22649)
@@ -8,4 +8,8 @@
 */
 #ifdef HAVE_GFAN
+
+#ifndef GFAN_H
+#define GFAN_H
+
 #include "intvec.h"
 
@@ -18,5 +22,6 @@
 extern int gfanHeuristic;
 //ideal getGB(ideal inputIdeal);
-ideal gfan(ideal inputIdeal, int heuristic);
+// ideal gfan(ideal inputIdeal, int heuristic);
+lists gfan(ideal inputIdeal, int heuristic);
 //int dotProduct(intvec a, intvec b);
 //bool isParallel(intvec a, intvec b);
@@ -99,4 +104,5 @@
 		 */
 		void fDebugPrint();
+		
 		friend class gcone;		
 };
@@ -182,7 +188,10 @@
 		void writeConeToFile(gcone const &gc, bool usingIntPoints=FALSE);
 		void readConeFromFile(int gcNum, gcone *gc);
+		void lprepareResult(lists l, gcone &gc);
 // 		static void gcone::idPrint(ideal &I);
+		intvec f2M(gcone *gc, facet *f);
 		friend class facet;	
 };
 
 #endif
+#endif
