protected Instances process(Instances instances) throws Exception {
    Instances	result;
    int		i;
    int		n;
    double[]	values;
    String	value;
    Instance	inst;
    Instance	newInst;
    
    // we need the complete input data!
    if (!isFirstBatchDone())
      setOutputFormat(determineOutputFormat(getInputFormat()));
    
    result = new Instances(getOutputFormat());
    
    for (i = 0; i < instances.numInstances(); i++) {
      inst   = instances.instance(i);
      values = inst.toDoubleArray();
      
      for (n = 0; n < values.length; n++) {
	if (    !m_Cols.isInRange(n)
	     || !instances.attribute(n).isNumeric() 
	     || inst.isMissing(n) )
	  continue;

	// get index of value
	if (instances.attribute(n).type() == Attribute.DATE)
	  value = inst.stringValue(n);
	else
	  value = Utils.doubleToString(inst.value(n), MAX_DECIMALS);
	
	values[n] = result.attribute(n).indexOfValue(value);
      }
      
      // generate new instance
      if (inst instanceof SparseInstance)
	newInst = new SparseInstance(inst.weight(), values);
      else
	newInst = new Instance(inst.weight(), values);
      
      // copy possible string, relational values
      newInst.setDataset(getOutputFormat());
      copyValues(newInst, false, inst.dataset(), getOutputFormat());
      
      result.add(newInst);
    }
    
    return result;
  }