     eavlArray *arrayToOperateOn = inField->GetArray();
     eavlIntArray *mapOutput = new eavlIntArray("inSelection", 1, arrayToOperateOn->GetNumberOfTuples());
     
+    
+    //----dump interesting paticles to array that qsort can use
+    int constArray_raw[chosenElements->GetNumberOfTuples()];
+    #pragma omp parallel for
+    for(int n = 0 ; n < chosenElements->GetNumberOfTuples(); n++ ) 
+    {
+        constArray_raw[n] = chosenElements->GetValue(n);
+
+    }
+        
     if(!presorted)
     {
-        //----dump interesting paticles to array that qsort can use
-        int array[chosenElements->GetNumberOfTuples()];
-#pragma omp parallel for
-        for(int n = 0 ; n < chosenElements->GetNumberOfTuples(); n++ ) 
-        {
-            array[n] = chosenElements->GetValue(n);
-
-        }
-        qsort(array, chosenElements->GetNumberOfTuples(), sizeof(int), cmpfunc);
-#pragma omp parallel for
-        for(int n = 0 ; n < chosenElements->GetNumberOfTuples(); n++ ) 
-        {
-            chosenElements->SetValue(n, array[n]);
-        }
-        //--
+        qsort(constArray_raw, chosenElements->GetNumberOfTuples(), sizeof(int), cmpfunc);
     }
    
-
+   //----put elements in const array for use in fuctor
+    eavlConstArray<int> *constArray;
+    INIT(eavlConstArray<int>,  constArray,  chosenElements->GetNumberOfTuples());
+    //--
+    
     //----perform map with custom selection fuctor
     eavlExecutor::AddOperation(new_eavlMapOp( eavlOpArgs(arrayToOperateOn),
                                               eavlOpArgs(mapOutput),
-                                              FindSelection(chosenElements)
+                                              FindSelection(constArray, chosenElements->GetNumberOfTuples())
                                              ),
                                 "test if in selection"
                                );

#include "eavlReduceOp_1.h"
#include "eavlReverseIndexOp.h"
#include "eavlSimpleReverseIndexOp.h"

//compare function for qsort
int cmpfunc (const void * a, const void * b)

                               );
    eavlExecutor::Go();
    //--


    //----perform reverse index
    eavlIntArray *interestingIndexes = new eavlIntArray("interestingIndexes", 
