     for(int i =0; i <depth; i++)
     {
         myKey[i] = (localAIndex+ i   < localAPartSize ? A_keys[myStartIdxA + localAIndex+i]   : MAX_VAL);
-        myVal[i] = (localAIndex + i   < localAPartSize ? A_vals[myStartIdxA + localAIndex+i]   : MAX_VAL);
+        myVal[i] = (localAIndex + i   < localAPartSize ? A_vals[myStartIdxA + localAIndex+i]   : UMAX_VAL);
     }
     
         

            else {
                for(int i = 0;i < depth; i++) {		
                    myKey[i] = (aIndex+depth*tid + i < sizePerPartition ? A_keys[myStartIdxA + aIndex+ depth*tid + i]   : MAX_VAL);					
                    myValue[i] = (aIndex+depth*tid + i < sizePerPartition ? A_values[myStartIdxA + aIndex+ depth*tid + i]   : MAX_VAL);
                }
            }			
            if(tid == CTASIZE_simple-1)		

	T MAX_VAL = getMax<T>();
	T MIN_VAL = getMin<T>();

	unsigned int UMAX_VAL = getMax<unsigned int>();

    int myId = blockIdx.x; int tid = threadIdx.x;
    int myStartId = (myId%subPartitions) + 2*(myId/subPartitions)*subPartitions; 
    int myStartIdxA = partitionBeginA[myStartId];
