Index: tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/chartsengine/jfreechart/JFCBalanceSpiderChartCreator.java
===================================================================
--- tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/chartsengine/jfreechart/JFCBalanceSpiderChartCreator.java	(revision 429)
+++ tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/chartsengine/jfreechart/JFCBalanceSpiderChartCreator.java	(revision 430)
@@ -9,7 +9,7 @@
 import org.jfree.chart.plot.SpiderWebPlot;
 import org.jfree.data.category.CategoryDataset;
 import org.jfree.data.category.DefaultCategoryDataset;
-import org.txm.core.results.ITXMResult;
+import org.txm.core.results.TXMResult;
 import org.txm.chartsengine.jfreechart.core.JFCChartCreator;
 import org.txm.textsbalance.core.functions.TextsBalance;
 
@@ -20,7 +20,7 @@
 	}
 
 	@Override
-	public JFreeChart createChart(ITXMResult result, String preferencesNode) {
+	public JFreeChart createChart(TXMResult result) {
 
 		final TextsBalance balance = (TextsBalance) result;
 		
@@ -62,7 +62,7 @@
 
 		// FIXME: tests
 		//this.getChartsEngine().getTheme().apply(chart);
-		this.getChartsEngine().getJFCTheme().applyThemeToChart(chart, result, preferencesNode);
+		this.getChartsEngine().getJFCTheme().applyThemeToChart(chart, result);
 		//this.getChartsEngine().getJFCTheme().apply(chart);
 //		this.getChartsEngine().getJFCTheme().apply(chart);
 		
Index: tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/chartsengine/r/RBalanceSpiderChartCreator.java
===================================================================
--- tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/chartsengine/r/RBalanceSpiderChartCreator.java	(revision 429)
+++ tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/chartsengine/r/RBalanceSpiderChartCreator.java	(revision 430)
@@ -2,7 +2,7 @@
 
 import java.io.File;
 
-import org.txm.core.results.ITXMResult;
+import org.txm.core.results.TXMResult;
 import org.txm.chartsengine.r.core.RChartCreator;
 import org.txm.chartsengine.r.core.RChartsEngine;
 import org.txm.textsbalance.core.functions.TextsBalance;
@@ -14,13 +14,13 @@
 	}
 
 	@Override
-	public Object createChart(ITXMResult result, String preferencesNode) {
+	public Object createChart(TXMResult result) {
 		// TODO Auto-generated method stub
 		return null;
 	}
 
 	@Override
-	public File createChartFile(ITXMResult result, File file, String preferencesNode) {
+	public File createChartFile(TXMResult result, File file) {
 		
 //		try {
 	
Index: tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/preferences/TextsBalancePreferences.java
===================================================================
--- tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/preferences/TextsBalancePreferences.java	(revision 429)
+++ tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/preferences/TextsBalancePreferences.java	(revision 430)
@@ -20,7 +20,7 @@
 	
 	public static final String PREFERENCES_PREFIX = "texts_balance_"; //$NON-NLS-1$
 	
-	public static final String GROUP_BY_WORDS = PREFERENCES_PREFIX + "count_by_words"; //$NON-NLS-1$
+	public static final String GROUP_BY_WORDS = PREFERENCES_PREFIX + "group_by_words"; //$NON-NLS-1$
 	public static final String METHOD = PREFERENCES_PREFIX + "method"; //$NON-NLS-1$
 	
 	// local result preferences
Index: tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/functions/TextsBalance.java
===================================================================
--- tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/functions/TextsBalance.java	(revision 429)
+++ tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/functions/TextsBalance.java	(revision 430)
@@ -11,8 +11,11 @@
 import java.util.List;
 
 import org.txm.Toolbox;
-import org.txm.core.results.ITXMResult;
-import org.txm.functions.Function;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.core.results.TXMResult;
+import org.txm.core.results.TXMParameters;
+import org.txm.functions.TXMCommand;
+import org.txm.functions.ProgressWatcher;
 import org.txm.searchengine.cqp.AbstractCqiClient;
 import org.txm.searchengine.cqp.CQPEngine;
 import org.txm.searchengine.cqp.NetCqiClient;
@@ -23,6 +26,7 @@
 import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
 import org.txm.searchengine.cqp.corpus.query.Match;
 import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.textsbalance.core.preferences.TextsBalancePreferences;
 import org.txm.utils.logger.Log;
 
 /**
@@ -32,7 +36,7 @@
  * @author sjacquot
  *
  */
-public class TextsBalance extends Function implements ITXMResult {
+public class TextsBalance extends TXMCommand {
 
 	
 	
@@ -56,6 +60,26 @@
 	}
 
 	
+
+
+	@Override
+	public boolean compute(ProgressWatcher watcher, TXMParameters parameters) {
+		try {
+			StructuralUnit su = this.getCorpus().getStructuralUnit((String) parameters.get(TextsBalancePreferences.STRUCTURAL_UNIT));
+			return this.compute(
+					(Integer)parameters.get(TextsBalancePreferences.METHOD),
+					su,
+					su.getProperties().get((Integer) parameters.get(TextsBalancePreferences.STRUCTURAL_UNIT_PROPERTY_INDEX)).getName(),
+					(Boolean)parameters.get(TextsBalancePreferences.GROUP_BY_WORDS));
+		}
+		catch(Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return false;
+	}
+	
+
 	/**
 	 * @param method 1: use CQL to solve matches, 2 uses corpus struct indexes, 2 is faster !
 	 * @param method
@@ -64,13 +88,13 @@
 	 * @param groupByTexts
 	 * @throws CqiClientException
 	 */
-	public void compute(int method, StructuralUnit su, String suPropertyName, boolean groupByTexts) throws CqiClientException {
+	public boolean compute(int method, StructuralUnit su, String suPropertyName, boolean groupByTexts) {
 		
 		this.name = su.getName() + "@" + suPropertyName + " (group by texts = " + groupByTexts + ")";
 		
 		Log.warning("Compute balance with metadata propertyName = " + suPropertyName + ", structural unit = " + su.getName() + " and count_texts = " + groupByTexts);
 		try {
-			if (suPropertyName == null || suPropertyName.length() == 0) return;
+			if (suPropertyName == null || suPropertyName.length() == 0) return false;
 			
 			
 			this.dataset = new HashMap<Integer, Comparable[]>();
@@ -106,7 +130,7 @@
 				AbstractCqiClient CQI = CQPEngine.getCqiClient();
 				if (CQI instanceof NetCqiClient) {
 					System.out.println("Error: CQP eval method only available with CQP memory mode");
-					return;
+					return false;
 				}
 
 				String supqn = p.getQualifiedName();
@@ -161,7 +185,9 @@
 		catch(Exception e) {
 			System.out.println("Error while computing text informations: "+e);
 			e.printStackTrace();
+			return false;
 		}
+		return true;
 	}
 	
 	
@@ -276,6 +302,6 @@
 		// TODO Auto-generated method stub
 		return null;
 	}
-	
-	
+
+
 }
