             pq->d_queue[selector][my_valid+far_pile_offset] = my_vert;
         
     }
+
+    static __device__ __forceinline__ void Compact2(
+                                            VertexId        *&vertex_in,
+                                            NearFarPile     *&pq,
+                                            int             &selector,
+                                            SizeT           &input_queue_length,
+                                            VertexId        *&vertex_out,
+                                            SizeT           &v_out_offset,
+                                            SizeT           &node_num)
+    {
+        int tid = threadIdx.x;
+        int bid = blockIdx.x;
+        int my_id = bid*blockDim.x + tid;
+        if (my_id >= input_queue_length)
+            return;
+
+        unsigned int my_vert = vertex_in[my_id];
+        if (my_vert<0 || my_vert >= node_num) return;
+        unsigned int my_valid = pq->d_valid_near[my_id];
+
+        if (my_valid == pq->d_valid_near[my_id+1]-1)
+            vertex_out[my_valid+v_out_offset] = my_vert;
+    }
 };
 
 /**

        vertex_out,
        v_out_offset,
        far_pile_offset,
        node_num);
}


        //printf("valid near, far: %d, %d\n", pq->d_valid_near[my_id], pq->d_valid_far[my_id]);
    }

    static __device__ __forceinline__ void MarkValid(
                                            VertexId     *&vertex_in,
                                            NearFarPile     *&pq,
                                            DataSlice       *&problem,
                                            SizeT &input_queue_length,
                                            SizeT       &node_num)
    {
        int tid = threadIdx.x;
        int bid = blockIdx.x;
        int my_id = tid + bid*blockDim.x;

        if (my_id >= input_queue_length)
            return;

        unsigned int my_vert = vertex_in[my_id];
        if (my_vert < 0 || my_vert >= node_num) { pq->d_valid_near[my_id] = 0; pq->d_valid_far[my_id] = 0; return; }
        pq->d_valid_near[my_id] = (my_id == problem->d_visit_lookup[my_vert]);
        pq->d_valid_far[my_id] = 0;
    }

    static __device__ __forceinline__ void Compact(
                                            VertexId        *&vertex_in,
                                            NearFarPile     *&pq,
